Word Break
Input: s = "leetcode", wordDict = ["leet", "code"]
Output: true
Explanation: Return true because "leetcode" can be segmented as "leet code".Input: s = "applepenapple", wordDict = ["apple", "pen"]
Output: true
Explanation: Return true because "applepenapple" can be segmented as "apple pen apple".
Note that you are allowed to reuse a dictionary word.Input: s = "catsandog", wordDict = ["cats", "dog", "sand", "and", "cat"]
Output: falseSolution
class Solution {
public boolean wordBreak(String s, List<String> wordDict) {
}
}Last updated