Word Break — build up a DP flag array
dp[i] answers "can the first i letters be cut into dictionary words?" It's true when some earlier cut point dp[j] is true and the piece between j and i is itself a word.
Try:
← Prev
Next →
▶ Play
Reset
s
dp (can s[0:i] be segmented?)