Dynamic programming(DP) has been a nightmare for most of us. The fact is more you avoid DP problems, the tougher it will get. I have attempted to explain DP using a standard DP problem “Longest Common Subsequence” which will help you get started with solving DP questions.


  1. Basic programming
  2. 2-D array


Dynamic programming is a technique to solve optimization problems[problems where you have to minimize or maximize]. It is used to save computation time at the expense of some space, by storing the solution to overlapping subproblems(explained below) and using them wherever they appear instead of recalculating.

When should…

Himanshu Kumar

Pre-final year computer science student with keen interest in full stack development and problem solving.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store