74. Word Break

Return true if s can be split into a sequence of one or more words from wordDict. Words may be reused.

Example 1

Input: s = "pineapplepen", wordDict = ["apple","pen","applepen","pine","pineapple"]
Output: true

Example 2

Input: s = "catsandog", wordDict = ["cats","dog","sand","and","cat"]
Output: false
Hint 1

dp[i] is true if some split point j < i has dp[j] true and s[j:i] is a word.

Dynamic ProgrammingHash TableString