0% found this document useful (0 votes)
144 views2 pages

Dynamic Programming Patterns Explained

Uploaded by

Rajni Singla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views2 pages

Dynamic Programming Patterns Explained

Uploaded by

Rajni Singla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

‭ ‬‭Dynamic Programming‬


‭Pattern 1: Fibonacci/Simple Recurrence‬
‭→ Climbing Stairs‬
‭→ Min Cost Climbing Stairs‬
‭→ Dice Combinations‬
‭→ Frog Jump‬
‭→ Fibonacci Number‬

‭ attern 2: 0/1 Knapsack‬


P
‭→ 0/1 Knapsack‬
‭→ Partition Equal Subset Sum‬
‭→ Target Sum‬
‭→ Subset Sum‬
‭→ Last Stone Weight II‬

‭ attern 3: Unbounded Knapsack‬


P
‭→ Coin Change‬
‭→ Coin Change II‬
‭→ Rod Cutting‬
‭→ Combination Sum IV‬
‭→ Integer Break‬

‭ attern 4: Longest Common Subsequence (LCS)‬


P
‭→ Longest Common Subsequence‬
‭→ Uncrossed Lines‬
‭→ Edit Distance‬
‭→ Shortest Common Supersequence‬
‭→ Delete Operation for Two Strings‬

‭ attern 5: Longest Increasing Subsequence (LIS)‬


P
‭→ Longest Increasing Subsequence‬
‭→ Wiggle Subsequence‬
‭→ Increasing Triplet Subsequence‬
‭→ Continuous Increasing Subsequence‬
‭→ Russian Doll Envelopes‬

‭ attern 6: Grid-Based DP‬


P
‭→ Unique Paths‬
‭→ Unique Paths II‬
‭→ Minimum Path Sum‬
‭→ Dungeon Game‬
‭→ Cherry Pickup‬
‭ attern 7: Interval DP‬
P
‭→ Burst Balloons‬
‭→ Palindrome Partitioning II‬
‭→ Merge Stones‬
‭→ Optimal BST‬
‭→ Strange Printer‬

‭ attern 8: Tree DP‬


P
‭→ House Robber III‬
‭→ Binary Tree Maximum Path Sum‬
‭→ Tree Diameter‬
‭→ Subtree Queries‬
‭→ Longest Univalue Path‬

‭ attern 9: Bitmasking/State Compression‬


P
‭→ Traveling Salesman‬
‭→ Campus Bikes II‬
‭→ Elevator Rides‬
‭→ Count All Possible Routes‬
‭→ Bitmask DP Template‬

‭ attern 10: Digit DP‬


P
‭→ Numbers With Repeated Digits‬
‭→ Count Digit One‬
‭→ Number of Digit One‬
‭→ Digit DP Template‬
‭→ Remove Digits‬

‭ attern 11: Probability/Expectation DP‬


P
‭→ Dice Roll Simulation‬
‭→ New 21 Game‬
‭→ Random Pick with Weight‬
‭→ Frog Jump Probability‬
‭→ Candy Lottery‬

You might also like