↓Skip to main content

Array

LeetCode 3644: Maximum K to Sort a Permutation
·2 mins
LeetCode Medium Bit-Manipulation Array
LeetCode 3644 note: every misplaced number must be swapped, so each bit of k must belong to all of them; the answer is the AND of every misplaced number
LeetCode 503: Next Greater Element II (Monotonic Stack)
·2 mins
LeetCode Daily Medium Array Stack Monotonic-Stack Circular-Array
Monotonic stack on a circular array
LeetCode 496: Next Greater Element I (Monotonic Stack)
·2 mins
LeetCode Daily Easy Array Stack Monotonic-Stack Hash-Map Next-Greater-Element
Monotonic decreasing stack over nums2 to build next-greater map; answer queries for nums1.
LeetCode 3439: Reschedule Meetings for Maximum Free Time (Sliding Window)
·3 mins
LeetCode Daily Medium Array Sliding-Window Two-Pointers Intervals
Sliding window over meetings; track total duration in a k-sized window and compute free span between boundaries.
LeetCode 209: Minimum Size Subarray Sum (Sliding Window)
·1 min
LeetCode Daily Medium Array Sliding-Window Two-Pointers Prefix-Sum Binary-Search
Sliding window with two pointers; minimize subarray length where sum ≥ target.
LeetCode 1695: Maximum Erasure Value (Sliding Window)
·1 min
LeetCode Daily Medium Array Sliding-Window Two-Pointers Hash-Set
Sliding window with a set and running sum; two pointers to keep the subarray unique.
LeetCode 1497: Check If Array Pairs Are Divisible by k (Remainder Pairing, Modulo)
·2 mins
LeetCode Daily Medium Array Hash-Map Complement Counting Math Modulo
Remainder pairing with a hash map; handle 0 and k/2 remainders carefully.
LeetCode 2709: Greatest Common Divisor Traversal
·3 mins
LeetCode Hard Math Number-Theory Union-Find Sieve Gcd Array
LeetCode 2709 note: every pair of indices connects ⇔ one component; factor with SPF and union each number with its prime factors in Union-Find, treating 1 specially
LeetCode 135: Candy
·2 mins
LeetCode Hard Greedy Array
LeetCode 135 note: one pass left to right for the left neighbor, one right to left for the right neighbor, and give each child the larger of the two
LeetCode 3638: Maximum Balanced Shipments
·2 mins
LeetCode Medium Dynamic-Programming Greedy Monotonic-Stack Array
LeetCode 3638 note: greedily cut a segment as soon as a value below its maximum appears; until then the segment is non-decreasing, so its maximum is the previous value
LeetCode 3637: Trionic Array I
·2 mins
LeetCode Easy Array
LeetCode 3637 note: walk one index through uphill, downhill and uphill; all three runs must be non-empty and reach the end exactly
LeetCode 1658: Minimum Operations to Reduce X to Zero
·3 mins
LeetCode Daily Medium Array Sliding-Window Prefix-Sum Reverse-Thinking
LeetCode Problem Solving - Reverse Thinking with Sliding Window