C/C++ Dynamic Programming Programs
Last Updated :
22 May, 2024
Improve
Dynamic programming refers to the programming paradigm in which the solution of the subproblems is memorized to avoid re-evaluation. Dynamic programming (DP) is the optimization of recursion that can only be applied to problems that have optimal substructure.
In this article, we will discuss some of the common practice problems in C/C++ that can be solved using Dynamic Programming.
Prerequisite: Introduction to Dynamic Programming
Dynamic Programming Problems in C/C++
The following is the list of C/C++ programs based on the level of difficulty:
Easy
- Program for Fibonacci Numbers
- Min Cost Path | DP-6
- Length of the Longest Substring without Repeating Characters
- Count All Possible Paths from Top Left to Bottom Right of a Mxn Matrix
- Friends Pairing Problem
- Count Number of Ways to Cover a Distance
- Gold Mine Problem
- Count All Possible Paths From Top Left to Bottom Right of Mxn Matrix
- Unbounded Knapsack (Repetition of Items Allowed)
- Longest Subsequence such that Difference Between Adjacents is One
Medium
- Maximum Size Square Sub-matrix with All 1s
- Longest Increasing Subsequence (LIS)
- Longest Common Subsequence (LCS)
- Edit Distance | DP-5
- Minimum Number of Jumps to Reach End
- Binomial Coefficient | DP-9
- 0/1 Knapsack Problem
- Longest Palindromic Subsequence | DP-12
- Cutting a Rod | DP-13
- Maximum Sum Increasing Subsequence | DP-14
Hard
- Coin Change | DP-7
- Matrix Chain Multiplication | DP-8
- Egg Dropping Puzzle | DP-11
- Palindrome Partitioning | DP-17
- Box Stacking Problem | DP-22
- Longest Palindromic Substring
- Optimal Binary Search Tree | DP-24
- Maximum Sum Rectangle in a 2D Matrix | DP-27
- Minimum Insertions to Form a Palindrome | DP-28
- Word Wrap Problem | DP-19