Medium
Array
Hash Table
String
DP
Given a string s
and a dictionary of strings wordDict
, return true
if s
can be segmented into a space-separated sequence of one or more dictionary words.
Note that the same word in the dictionary may be reused multiple times in the segmentation.
Example 1:
Example 2:
Example 3:
Constraints:
s.length
<= 300wordDict.length
<= 1000wordDict[i].length
<= 20s
and wordDict[i]
consist of only lowercase English letters.wordDict
are unique.Jerry Wu4 August, 2023
Yen-Chi ChenSat, Aug 5, 2023