Dashboard
LC #139
Word Break
Pattern · ?AmazonGoogleMetaBloombergMicrosoft
Problem
Determine if a string can be segmented into words from a dictionary.
Constraints
- 1 ≤ s.length ≤ 300
- 1 ≤ wordDict.length ≤ 1000
- 1 ≤ wordDict[i].length ≤ 20
- Lowercase English only; no duplicate words
Example
- Input
- s = "leetcode", wordDict = ["leet","code"]
- Output
- true
- Why
- "leetcode" = "leet" + "code". Both words in dictionary
Spot the pattern
Which pattern cracks it?
Hints
One at a time