Digit DP
Count numbers in a range with a digit property by processing digits with a "tight" flag.
Decision · step 3 of 8Digit DP: Numbers up to 275 without a 7
Position 2, tight: 275 has the digit 5 here. A digit below 5 frees the rest: 5 allowed choices x 1 = 5. Choosing 5 itself keeps the number tight, adding the tight count of the next position, 1. Total 6.
What you will see
Digit positions as columns; the tight flag splits each column in two.
Cost
| Best | O(digits * states) |
|---|---|
| Average | O(digits * states) |
| Worst | O(digits * states) |
| Space | O(digits * states) |
How you work with it here
play it through, step one change at a time, scrub to any step, run it on your own input, predict what happens next.
Screen readers: Table cells announce their state and value; each step announces which cells were read and the value written.
Reduced motion: Dependency arrows appear statically and the cell value crossfades.