dp[i] is true if the prefix s[0..i) can be segmented into dictionary words: dp[i] = OR over j of (dp[j] AND s[j..i) is a word). Watch the scan fill dp and reconstruct one segmentation.
step 0
String & current scan
Dictionary:
Testing chunk s[j..i) against the dictionary; dp[i] turns green when a word ends here and dp[j] was already true.
scan end i chunk s[j..i) dp = true
dp[] boolean array
Reconstructed segmentation (one valid split):
—
Press Step to begin. We seed dp[0] = true (the empty prefix), then scan each end index i and test every chunk s[j..i) against the dictionary.
Self-contained visualization. Boolean DP, the Word Break I decision version. dp[0] = true is the empty-prefix base case;
the answer is dp[n]. The inner loop tests chunks s[j..i); when one is a dictionary word and dp[j] is already true, dp[i] becomes true.
See junior.md and professional.md for the recurrence and its correctness proof.