↓Skip to main content

Dynamic-Programming

LeetCode 1449: Form Largest Integer With Digits That Add Up To Target
·3 mins
LeetCode Hard Dynamic-Programming Knapsack
LeetCode note for Form Largest Integer With Digits That Add Up To Target, rebuilt from the original learning note
LeetCode 1049: Last Stone Weight II
·3 mins
LeetCode Medium Dynamic-Programming Knapsack Subset-Sum
LeetCode note for Last Stone Weight II, rebuilt from the original learning note
LeetCode 1235: Maximum Profit in Job Scheduling
·2 mins
LeetCode Hard Dynamic-Programming Binary-Search Sorting Array
LeetCode 1235 note: sort jobs by end time with best[j] = best profit using the first j jobs; taking job j binary-searches the last job ending <= its start
LeetCode 2912: Number of Ways to Reach Destination in the Grid
·3 mins
LeetCode Hard Dynamic-Programming State-Machine Math Combinatorics
LeetCode 2912 note: many cells, but only four classes relative to the destination (itself, same row, same column, neither); each class’s total moves together in O(k)
LeetCode 902: Numbers At Most N Given Digit Set
·2 mins
LeetCode Hard Dynamic-Programming Digit-Dp Math Binary-Search String
LeetCode 902 note: digit DP with state (pos, tight, started); before starting, a position can be skipped, representing numbers with fewer digits than n
LeetCode 2355: Maximum Number of Books You Can Take
·2 mins
LeetCode Hard Dynamic-Programming Monotonic-Stack Stack Array
LeetCode 2355 note: ending at i, each shelf to the left takes one fewer book until a bottleneck shelf j with too few books; a monotonic stack finds j, and dp[i] = dp[j] + an arithmetic series
LeetCode 1092: Shortest Common Supersequence
·5 mins
LeetCode Hard Dynamic-Programming String
LeetCode note for Shortest Common Supersequence, rebuilt from the original learning note
LeetCode 712: Minimum ASCII Delete Sum for Two Strings
·4 mins
LeetCode Medium Dynamic-Programming String
LeetCode note for Minimum ASCII Delete Sum for Two Strings, rebuilt from the original learning note
LeetCode 1312: Minimum Insertion Steps to Make a String Palindrome
·4 mins
LeetCode Hard Dynamic-Programming String Palindrome
LeetCode note for Minimum Insertion Steps to Make a String Palindrome, rebuilt from the original learning note
LeetCode 583: Delete Operation for Two Strings
·4 mins
LeetCode Medium Dynamic-Programming String
LeetCode note for Delete Operation for Two Strings, rebuilt from the original learning note
LeetCode 115: Distinct Subsequences
·3 mins
LeetCode Hard Dynamic-Programming String
LeetCode note for Distinct Subsequences, rebuilt from the original learning note
LeetCode 97: Interleaving String
·4 mins
LeetCode Medium Dynamic-Programming String
LeetCode note for Interleaving String, rebuilt from the original learning note