Sep 25, 20251 min read

DP is easy

Yes am not saying that but it is, you just need to get things for the basics

Two methods

  • Recursive Top Down Memoization
  • Iterative Bottom Up Tabulation

Coin Change II https://leetcode.com/problems/coin-change-ii/

  • Paste each line of the problem in the code as comments this will make understanding easier
  • Take a look at the examples input and outputs
  • Write a short summary of the problem
  • Now think of those small independently How to make observation
  • Take ith or skip ith ... and so on
  • Now simulate an general example let say ith. How to simulate recursion
  • Recursion is your friend then How to make recursion your friend

Lets sum up

DP is easy

DP = Decision parameterization