Hard
LeetCode 757: Set Intersection Size At Least Two
·2 mins
LeetCode
Hard
Greedy
Sorting
LeetCode 757 note: sort by right end (larger left end first on ties) and track only the two rightmost points; add the two right-end points when uncovered, or the right end when only one is covered
LeetCode 552: Student Attendance Record II
·2 mins
LeetCode
Hard
Dynamic-Programming
State-Machine
LeetCode 552 note: state machine DP with state “A used × trailing L run”, 6 states; each day’s P, A or L picks the next state
LeetCode 51: N-Queens
·2 mins
LeetCode
Hard
Backtracking
LeetCode 51 note: one queen per row, with three sets tracking occupied columns and both diagonals
LeetCode 488: Zuma Game
·3 mins
LeetCode
Hard
Dynamic-Programming
Memoization
Breadth-First-Search
String
Stack
LeetCode 488 note: with at most 16 balls on the board and 5 in hand, memoize DFS on the whole (board, hand) state, inserting only before a same-colored ball or between two equal balls
LeetCode 1402: Reducing Dishes
·2 mins
LeetCode
Hard
Dynamic-Programming
Greedy
Sorting
Array
LeetCode 1402 note: sort and take dishes from most satisfying down; each new dish goes first and shifts the chosen ones one slot later, adding the current chosen sum, so keep going while that sum is positive
LeetCode 1411: Number of Ways to Paint N × 3 Grid
·2 mins
LeetCode
Hard
Dynamic-Programming
State-Machine
Graph-Coloring
LeetCode 1411 note: a row’s colorings come in two patterns, ABA (ends match) and ABC (all different), 6 each; the next row gives ABA → 3 ABA + 2 ABC and ABC → 2 ABA + 2 ABC
LeetCode 1289: Minimum Falling Path Sum II
·3 mins
LeetCode
Hard
Dynamic-Programming
Grid-Dp
LeetCode note for Minimum Falling Path Sum II, rebuilt from the original learning note
LeetCode 1526: Minimum Number of Increments on Subarrays to Form a Target Array
·1 min
LeetCode
Hard
Dynamic-Programming
Greedy
Monotonic-Stack
Array
LeetCode 1526 note: scanning left to right, every rise above the previous height needs that many new operations; drops reuse earlier operations
LeetCode 1335: Minimum Difficulty of a Job Schedule
·2 mins
LeetCode
Hard
Dynamic-Programming
Interval-Dp
Array
LeetCode 1335 note: partition DP into d segments; dp(i, k) = the least difficulty starting at job i with k days left, enumerating where today ends while updating today’s maximum
LeetCode 1147: Longest Chunked Palindrome Decomposition
·2 mins
LeetCode
Hard
Dynamic-Programming
Greedy
Two-Pointers
Rolling-Hash
String
LeetCode 1147 note: build strings inward from both ends and cut a pair as soon as they match; cutting early is best, and any leftover middle counts as one chunk
LeetCode 174: Dungeon Game
·3 mins
LeetCode
Hard
Dynamic-Programming
Grid-Dp
LeetCode note for Dungeon Game, rebuilt from the original learning note
LeetCode 1745: Palindrome Partitioning IV
·2 mins
LeetCode
Hard
Dynamic-Programming
Interval-Dp
String
LeetCode 1745 note: build is_pal[i][j] with interval DP, then try both cut points; three palindromic parts means true, O(n^2)