Word Break
Problem
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: false
Pseudocode
Solution
Time and Space Complexity
Time
Space
Last updated