string - best algorithm to find words in a paragraph? -
given paragraph of text , list of strings return list of strings contained in paragraph.
notice in list of string each string can contain multiple words.
example
input text "i love java program" , string list is{"java","java program","java , c program"} should return {"java program"}
best algorithm , data structure use in term of time complexity
your description doesn't specify returned list should (presumably maximum) subset of given list. therefore, best algorithm trivial o(1) solution: return [string(paragraph[0])]
.
Comments
Post a Comment