// Select a DP algorithm to see its code
Select a DP algorithm and click visualize to see the explanation of each step.
| Algorithm | Time Complexity | Space Complexity | Description |
|---|---|---|---|
| Fibonacci Sequence | O(n) | O(n) / O(1) (optimized) | Calculates the nth Fibonacci number using DP. |
| Climbing Stairs | O(n) | O(n) / O(1) (optimized) | Counts ways to reach the top of stairs. |
| House Robber | O(n) | O(n) / O(1) (optimized) | Maximizes stolen value from houses. |
| Longest Increasing Subsequence (LIS) | O(n^2) / O(n log n) | O(n) | Finds the longest increasing subsequence. |
| Maximum Subarray Sum | O(n) | O(1) | Finds the contiguous subarray with the largest sum. |
| Cutting Rod | O(n^2) | O(n) | Maximizes value by cutting a rod. |
| Unique Paths in a Grid | O(m*n) | O(m*n) | Counts paths in a grid. |
| Minimum Cost Path in a Grid | O(m*n) | O(m*n) | Finds the minimum cost path in a grid. |
| Edit Distance | O(m*n) | O(m*n) | Calculates edit distance between two strings. |
| Longest Common Subsequence (LCS) | O(m*n) | O(m*n) | Finds the longest common subsequence. |
| Knapsack 0/1 | O(n*W) | O(n*W) | Solves the 0/1 knapsack problem. |
| Matrix Chain Multiplication | O(n^3) | O(n^2) | Optimizes matrix chain multiplication. |
| Triangle Path Sum | O(n^2) | O(n^2) | Finds the minimum path sum in a triangle. |