| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -488,7 +488,11 @@ func wordBreak(s string, wordDict []string) bool { | |||
| 488 | 488 | f[0] = true | |
| 489 | 489 | max := maxLen(wordDict) | |
| 490 | 490 | for i := 1; i <= len(s); i++ { | |
| 491 | - for j := i - max; j < i && j >= 0; j++ { | ||
| 491 | + l := 0 | ||
| 492 | + if i - max > 0 { | ||
| 493 | + l = i - max | ||
| 494 | + } | ||
| 495 | + for j := l; j < i; j++ { | ||
| 492 | 496 | if f[j] && inDict(s[j:i]) { | |
| 493 | 497 | f[i] = true | |
| 494 | 498 | break | |
| Back | FazBrowse Home | New Git URL |
0 commit comments