Array
LeetCode 452: Minimum Number of Arrows to Burst Balloons
·2 mins
LeetCode
Medium
Array
Greedy
Sorting
LeetCode 452 note: sort by end and shoot at the end; only a balloon starting after the arrow needs a new one, and touching ends count as overlapping
LeetCode 1011: Capacity To Ship Packages Within D Days
·2 mins
LeetCode
Medium
Array
Binary-Search
LeetCode 1011 note: binary search on the answer over [max(weights), sum(weights)], checking the day count by filling greedily in order
LeetCode 4099: Minimum Operations to Sort With Locked Indices
·3 mins
LeetCode
Medium
Array
Merge-Sort
Greedy
LeetCode 4099 note: the swaps needed equal the inversion count; every locked position some element must cross has to be unlocked, so count those, compare with k, and add the inversions counted with merge sort
LeetCode 4097: Minimum Value of Merged Integers
·1 min
LeetCode
Easy
Array
String
Simulation
LeetCode 4097 note: only merge the fixed pairs (0,1), (2,3), …, stepping by 2, not every adjacent pair
LeetCode 889: Construct Binary Tree from Preorder and Postorder Traversal
·2 mins
LeetCode
Medium
Array
Hash-Table
Divide-and-Conquer
Tree
Binary-Tree
LeetCode 889 note: keep the current path on a stack; when its top equals the next postorder value that subtree is complete and is popped; new nodes go left first
LeetCode 1186: Maximum Subarray Sum with One Deletion
·2 mins
LeetCode
Medium
Array
Dynamic-Programming
LeetCode 1186 note: Kadane with one more state, ending here with no deletion or with one deletion; update the answer at every step
Matrix
·5 mins
Algorithm
Matrix
Simulation
Array
Transposing and rotating, converting between 2D indices and a 1D sequence, neighbors and diagonals, and spiral traversal with four boundaries
Hash Table
·8 mins
Algorithm
Hash-Table
Counting
Array
Counting and frequency of frequencies, using the array itself as a hash table (sign marking), counting several keys at once (rows, columns, diagonals), incremental counts from a fixed left end, and grouping by a normalized key
Array Scanning
·7 mins
Algorithm
Array
Simulation
Enumeration
Adjacent comparisons and walking monotonic runs (uphill, downhill, hills and valleys), keeping prefix / suffix maximums and sums in one pass, enumerating pairs in small ranges, and breaking ties with tuple keys
LeetCode 775: Global and Local Inversions
·3 mins
LeetCode
Medium
Array
Math
LeetCode 775 note: turn a counting problem into an existence check and solve it in O(n)
LeetCode 305: Number of Islands II
·3 mins
LeetCode
Hard
Union-Find
Hash-Table
Array
LeetCode 305 note: each new land cell adds an island, then merges with neighboring land, subtracting 1 per successful merge; skip repeated positions
LeetCode 2584: Split the Array to Make Coprime Products
·3 mins
LeetCode
Hard
Math
Number-Theory
Sieve
Hash-Table
Array
LeetCode 2584 note: coprime products ⇔ no prime factor in both parts; record each prime’s last index, extend reach left to right, and split after i when reach == i