🧮Dynamic Programming
Also known as DP
Saving the answers to small parts that repeat. Each is solved once.
Think of it like
Think of it like a notebook of sums. Write each one down, so you never work it out twice.
Example
Jack works out the 50th Fibonacci number. Saving each smaller one makes 49 additions, not billions of calls.
Why it matters
Route maps, spell checkers and DNA tests all use it. Without it, those jobs would never finish.
Definition
Common mistake
Key takeaways
- 1Small parts repeat. That is the sign.
- 2Save each answer. Never solve twice.
- 3Top down or bottom up. Memo or table.