Objective
Given a string without spaces and a set of words, can the string be split into a sequence of words from the set (each may be repeated)? can[i] says whether the prefix of length i can be segmented.
Instructions
- The first line is the string and the second the dictionary words, separated by spaces.
- Show
Can be segmentedorCannot be segmented.
leetcode
leet code
Can be segmented
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise