1D DP
O(n)One number per position. Each entry comes from the few entries just before it.
Reach for it when the input is a line, such as steps, houses or characters, and the answer ati depends only on earlier positions.Go deeper: From memoised recursion to dynamic programming