| 54 | |
| 55 | """ |
| 56 | class Solution(object): |
| 57 | def wordBreak(self, s, wordDict): |
| 58 | """ |
| 59 | :type s: str |
| 60 | :type wordDict: List[str] |
| 61 | :rtype: bool |
| 62 | """ |
| 63 | |
| 64 | dp = [True] + [False] * len(s) |
| 65 | |
| 66 | for i in range(len(s)): |
| 67 | for j in range(i+1): |
| 68 | if dp[j] == True: |
| 69 | for x in wordDict: |
| 70 | if x == s[j:j+len(x)]: |
| 71 | dp[j+len(x)] = True |
| 72 | |
| 73 | return dp[-1] |
nothing calls this directly
no outgoing calls
no test coverage detected