🧠Paradigms
Dynamic Programming Algorithms
Stack answers to small problems into big ones. Learn the 2 topics below step by step with interactive visualizations.
🧠Fibonacci Sequence (DP)
Dynamic programming stores and reuses previously computed subsolutions in a table to eliminate redundant work. It's the classic memoization example, pulling naive recursion from O(2^n) down to O(n).
O(n)🧠Longest Increasing Subsequence (LIS)
Finds the length of the longest increasing subsequence you can pick while preserving order. dp[i] is defined as the subsolution 'length of the LIS ending at element i', and reusing the subsolutions of earlier, smaller elements pulls the O(2ⁿ) brute force down to O(n²).
O(n²)