Given a string s and a dictionary wordDict, return true if s can be segmented into a space-separated sequence of dictionary words.
s
wordDict
true
Words may be reused any number of times.
s = "leetcode", wordDict = ["leet","code"]
s = "applepenapple", wordDict = ["apple","pen"]
1 <= s.length <= 300 1 <= wordDict.length <= 1000 Words are lowercase and unique.
Topics
Implement wordBreak in the editor and return the answer — printing it is never graded.
wordBreak
Problem 91 of 1146 in the arena