Top 50 Dynamic Programming Practice Problems
Dynamic Programming is a method for solving a complex problem by breaking it down into a collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions using a memory-based data structure (array, map,etc). Each of the subproblem solutions is indexed in some way, typically based on the values of its input parameters, so as to facilitate its lookup. So the next time the same subproblem occurs, instead of recomputing its solution, one simply looks up the previously computed solution, thereby saving computation time. This technique of storing solutions to subproblems instead of recomputing them is called memoization.
Here’s brilliant explanation on concept of Dynamic Programming on Quora — Jonathan Paulson’s answer to How should I explain dynamic programming to a 4-year-old?
Please find below top 50 common data structure problems that can be solved using Dynamic programming
- Longest Common Subsequence | Introduction & LCS Length 最长的公共子序列
- Longest Common Subsequence | Finding all LCS — Techie Delight 找到所有的最长公共子序列
- Longest Common Substring problem — Techie Delight 最长公共子字符串
- Longest Palindromic Subsequence using Dynamic Programming
- Longest Repeated Subsequence Problem — Techie Delight 最长重复子序列问题
- Implement Diff Utility — Techie Delight
- Shortest Common Supersequence | Introduction & SCS Length
- Shortest Common Supersequence | Finding all SCS — Techie Delight
- Longest Increasing Subsequence using Dynamic Programming — Techie Delight
- Longest Bitonic Subsequence — Techie Delight
- Increasing Subsequence with Maximum Sum — Techie Delight
- The Levenshtein distance (Edit distance) problem — Techie Delight
- Find size of largest square sub-matrix of 1’s present in given binary matrix — Techie Delight
- Matrix Chain Multiplication using Dynamic Programming
- Find the minimum cost to reach last cell of the matrix from its first cell — Techie Delight
- Find longest sequence formed by adjacent numbers in the matrix — Techie Delight
- Count number of paths in a matrix with given cost to reach destination cell
- 0–1 Knapsack problem — Techie Delight
- Maximize the Value of an Expression — Techie Delight
- Partition problem | Dynamic Programming Solution — Techie Delight
- Subset Sum Problem — Techie Delight
- Minimum Sum Partition Problem — Techie Delight
- Find all N-digit binary strings without any consecutive 1’s — Techie Delight
- Rod Cutting Problem — Techie Delight
- Maximum Product Rod Cutting — Techie Delight
- Coin change-making problem (unlimited supply of coins) — Techie Delight
- Coin Change Problem (Total number of ways to get the denomination of coins) — Techie Delight
- Longest Alternating Subsequence Problem — Techie Delight
- Count number of times a pattern appears in given string as a subsequence
- Collect maximum points in a matrix by satisfying given constraints — Techie Delight
- Count total possible combinations of N-digit numbers in a mobile keypad — Techie Delight
- Find Optimal Cost to Construct Binary Search Tree — Techie Delight
- Word Break Problem | Dynamic Programming — Techie Delight
- Word Break Problem | Using Trie Data Structure — Techie Delight
- Total possible solutions to linear equation of k variables — Techie Delight
- Wildcard Pattern Matching — Techie Delight
- Find Probability that a Person is Alive after Taking N steps on an Island
- Calculate sum of all elements in a sub-matrix in constant time — Techie Delight
- Find Maximum Sum Submatrix in a given matrix — Techie Delight
- Find Maximum Sum Submatrix present in a given matrix — Techie Delight
- Find maximum sum of subsequence with no adjacent elements — Techie Delight
- Maximum Subarray Problem (Kadane’s algorithm) — Techie Delight
- Single-Source Shortest Paths — Bellman Ford Algorithm — Techie Delight
- All-Pairs Shortest Paths — Floyd Warshall Algorithm — Techie Delight
- Pots of Gold Game using Dynamic Programming — Techie Delight
- Find minimum cuts needed for palindromic partition of a string
- Maximum Length Snake Sequence — Techie Delight
- 3-Partition Problem — Techie Delight
- Calculate size of the largest plus of 1’s in binary matrix — Techie Delight
- Check if given string is interleaving of two other given strings