Dynamic Programming

Majority of the Dynamic Programming problems can be categorized into two types:

1. Optimization problems. 2. Combinatorial problems.

  • The optimization problems expect you to select a feasible solution, so that the value of the required function is minimized or maximized.

  • Combinatorial problems expect you to figure out the number of ways to do something, or the probability of some event happening.

Linear and Misc Dp Questions

1.House Robberchevron-right2.Climbing Stairschevron-right11.Longest Consecutive Sequencechevron-right20. Uncrossed Lineschevron-right24. Decode Wayschevron-right38. 2 Keys Keyboardchevron-right44. 0-1 Knapsackchevron-right48.Jump Gamechevron-right55. Partition Array for Maximum Sumchevron-right

Longest Increasing Subsequence variants:

9.Longest Increasing Subsequencechevron-right29. Longest String Chainchevron-right30. Maximum Length of Pair Chainchevron-right42. Number of Longest Increasing Subsequencechevron-right43. Russian Doll Envelopeschevron-right50. Length of Longest Fibonacci Subsequencechevron-right54. Best Team With No Conflictschevron-right

Partition Subset / Target Sum:

15.Partition Equal Subset Sumchevron-right16. Last Stone Weight IIchevron-right14.Target Sumchevron-right35. Partition to K Equal Sum Subsetschevron-right

Palindrome:

3.Longest Palindromic Substringchevron-right4.Longest Palindromic Subsequencechevron-right39. Palindrome Partitioning IIchevron-right47. Minimum Insertion Steps to Make a String Palindromechevron-right52. Palindromic Substringschevron-right

Matrix/2D Array:

7.Unique Pathschevron-right8.Minimum Path Sumchevron-right22. Maximal Squarechevron-right31. Minimum Falling Path Sumchevron-right37. Count Square Submatrices with All Oneschevron-right

Minimax DP:

32. Predict the Winnerchevron-right33. Delete and Earnchevron-right

Longest Common Subsequence Variant:

10.Longest Common Subsequencechevron-right28. Maximum Length of Repeated Subarraychevron-right49. Shortest Common Supersequencechevron-right53. Distinct Subsequenceschevron-right

Coin Change variant:

12.Coin Changechevron-right13.Coin Change 2chevron-right23. Perfect Squareschevron-right25. Minimum Cost For Ticketschevron-right56. Ones and Zeroeschevron-right

State machine:

5.Best Time to Buy and Sell Stockchevron-right6.Best Time to Buy and Sell Stock with Cooldownchevron-right51. Maximum Alternating Subsequence Sumchevron-right

Matrix multiplication variant:

19.Burst Balloonschevron-right

Dp on Strings

17.Word Breakchevron-right18. Word Break IIchevron-right21. Wildcard Matchingchevron-right27. Delete Operation for Two Stringschevron-right36. Different Ways to Add Parentheseschevron-right45. Interleaving Stringchevron-right46. Edit Distancechevron-right

Unbounded Knapsack:

40. Integer Breakchevron-right41.Cutting a Rodchevron-right

Dp on Trees:

34. House Robber IIIchevron-right

Last updated