LeetCode
LeetCode 1833: Maximum Ice Cream Bars
·2 mins
LeetCode
Medium
Greedy
Sorting
Counting-Sort
LeetCode 1833 note: buy the cheapest first; the problem asks for counting sort, and with values up to 10^5 each price buys min(count, coins // price)
LeetCode 307: Range Sum Query - Mutable
·3 mins
LeetCode
Medium
Segment-Tree
Binary-Indexed-Tree
Design
Array
LeetCode 307 note: point updates with range sums make prefix sums O(n) per update; a segment tree or Fenwick tree makes both operations O(log n)
LeetCode 3961: Maximize Sum of Device Ratings
·2 mins
LeetCode
Medium
Greedy
Sorting
Matrix
LeetCode 3961 note: every device but one donates its smallest unit to the same device; that device’s rating becomes the global minimum, so pick the one with the smallest second-smallest value
LeetCode 3960: Frequency Balance Subarray
·2 mins
LeetCode
Medium
Hash-Table
Counting
Array
LeetCode 3960 note: n is only 1000, so fix the left end and extend right while maintaining value -> count and count -> how many; exactly two counts f and 2f means balanced
LeetCode 3959: Check Good Integer
·1 min
LeetCode
Easy
Math
Simulation
LeetCode 3959 note: accumulate the square sum minus the digit sum; each digit adds d² − d ≥ 0, so the gap never shrinks and you can return as soon as it reaches 50
LeetCode 3952: Maximum Total Value of Covered Indices
·2 mins
LeetCode
Medium
Dynamic-Programming
State-Machine
Greedy
String
LeetCode 3952 note: each token moves left at most once, so the state is whether this index’s token moved left; moving only helps if the index to the left was not already covered
LeetCode 3951: Minimum Energy to Maintain Brightness
·2 mins
LeetCode
Medium
Array
Sorting
LeetCode 3951 note: a bulb lights at most 3 positions, so each time unit needs ceil(brightness / 3) bulbs; merge the intervals for the total time and multiply
LeetCode 3950: Exactly One Consecutive Set Bits Pair
·1 min
LeetCode
Easy
Bit-Manipulation
LeetCode 3950 note: each 1 in n & (n » 1) marks a pair of adjacent ones, so exactly one pair means it has a single 1
LeetCode 790: Domino and Tromino Tiling
·3 mins
LeetCode
Medium
Dynamic-Programming
LeetCode note for Domino and Tromino Tiling, rebuilt from the original learning note
LeetCode 276: Paint Fence
·3 mins
LeetCode
Medium
Dynamic-Programming
LeetCode note for Paint Fence, rebuilt from the original learning note
LeetCode 801: Minimum Swaps To Make Sequences Increasing
·4 mins
LeetCode
Hard
Dynamic-Programming
LeetCode note for Minimum Swaps To Make Sequences Increasing, rebuilt from the original learning note
LeetCode 376: Wiggle Subsequence
·3 mins
LeetCode
Medium
Dynamic-Programming
Greedy
LeetCode note for Wiggle Subsequence, rebuilt from the original learning note