Given a string s and a dictionary of words, determine if s can be segmented into space-separated dictionary words.
With s = "leetcode" and wordDict = ["leet","code"]:
- "leetcode" = "leet" + "code".
- Both in dictionary. Return true.
With s = "applepenapple" and wordDict = ["apple","pen"]:
- "applepenapple" = "apple" + "pen" + "apple".
- Words can be reused. Return true.
With s = "catsandog" and wordDict = ["cats","dog","sand","and","cat"]:
- No valid segmentation exists. Return false.
Constraints: s.length .