Dynamic-Programming
LeetCode 4041: Minimum Operations to Form Subset Sum II
·2 mins
LeetCode
Hard
Dynamic-Programming
Knapsack
Breadth-First-Search
Array
LeetCode 4041 note: with operations in any order, BFS finds every value a number can become (up to sum) with the fewest steps, then the same grouped 0/1 knapsack as 4040
LeetCode 4040: Minimum Operations to Form Subset Sum I
·2 mins
LeetCode
Medium
Dynamic-Programming
Knapsack
Array
LeetCode 4040 note: with multiplications before divisions, the best is always multiply-only or divide-only; list each number’s reachable values and costs, then run a grouped 0/1 knapsack
LeetCode 2328: Number of Increasing Paths in a Grid
·2 mins
LeetCode
Hard
Dynamic-Programming
Grid-Dp
Memoization
Topological-Sort
Matrix
LeetCode 2328 note: strictly increasing means no cycles; dp[cell] = 1 + Σ dp[larger neighbors], processed from largest to smallest value (or by memoized DFS), summed over all cells
LeetCode 2585: Number of Ways to Earn Points
·2 mins
LeetCode
Hard
Dynamic-Programming
Knapsack
Array
LeetCode 2585 note: a bounded (grouped) knapsack; each question type takes 0 to count questions, with capacity running backwards and the count enumerated inside
LeetCode 410: Split Array Largest Sum
·2 mins
LeetCode
Hard
Dynamic-Programming
Binary-Search
Greedy
Prefix-Sum
Array
LeetCode 410 note: binary search the answer; for a cap mid, greedily fill each segment to count the fewest segments, and mid works if that count is <= k
LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers
·2 mins
LeetCode
Hard
Dynamic-Programming
State-Machine
String
LeetCode 1320 note: after typing word[i], one finger is always on word[i], so the state is only the other finger’s position; dp[other] is the least distance with the other finger at other
LeetCode 518: Coin Change 2
·3 mins
LeetCode
Medium
Dynamic-Programming
Unbounded-Knapsack
LeetCode note for Coin Change 2, rebuilt from the original learning note
LeetCode 494: Target Sum
·3 mins
LeetCode
Medium
Dynamic-Programming
Knapsack
Subset-Sum
LeetCode note for Target Sum, rebuilt from the original learning note
LeetCode 416: Partition Equal Subset Sum
·3 mins
LeetCode
Medium
Dynamic-Programming
Knapsack
Subset-Sum
LeetCode note for Partition Equal Subset Sum, rebuilt from the original learning note
LeetCode 1155: Number of Dice Rolls With Target Sum
·3 mins
LeetCode
Medium
Dynamic-Programming
Counting
LeetCode note for Number of Dice Rolls With Target Sum, rebuilt from the original learning note
LeetCode 879: Profitable Schemes
·3 mins
LeetCode
Hard
Dynamic-Programming
Knapsack
LeetCode note for Profitable Schemes, rebuilt from the original learning note
LeetCode 474: Ones and Zeroes
·3 mins
LeetCode
Medium
Dynamic-Programming
Knapsack
LeetCode note for Ones and Zeroes, rebuilt from the original learning note