Error: cannot solve it. Use recursion to do this, func(s, word_map, word_set) check if current string s can word break or not. And word_map store intermediate result. In the function, check if left substring s is within the word_set and rig
Error:
cannot solve it. Use recursion to do this, func(s, word_map, word_set) check if current string s can word break or not. And word_map store intermediate result.
In the function, check if left substring s is within the word_set and right substring is able to word break or not. I.e., check word_set.find(left(s, p, len)) && func(s.substr(p+len), word_map, word_set);