Word Break (LeetCode 139).
Asked in the Coding stage. Reported follow-ups: Word Break II (LeetCode 140).
Given a string s and a list of words wordDict, return True if s can be segmented into one or more dictionary words, where each word in wordDict may be reused multiple times. Otherwise return False.
def word_break(s, wordDict):
s: a stringwordDict: a list of stringsdef word_break(s, wordDict):