Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

[Q] Most efficient approach to split a string into words

Revision en2, by Bliss8, 2017-07-18 02:12:27

question example:
given a string "aaaabbbasd" and dictionary, for example {a, aa, aaa, b, bb, s, d}
1) find one possible way to split the string into words from dictionary
2) find all possible ways to split the string into words from dictionary

Searching for the best approach on web I found different ones: dp, backtracking + memorization, dfs + memorization.
I lost in all of this huge variety.
Does somebody know what approach is the best here?

Tags word, break, split

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Bliss8 2017-07-18 02:12:27 1 Tiny change: 'ebody knows what appr' -> 'ebody know what appr'
en1 English Bliss8 2017-07-18 02:09:36 530 Initial revision (published)