Simulation
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
String
·7 mins
Algorithm
String
Simulation
Hash-Table
Simulation by building a list, parsing by trying every pattern at each position, all substrings of length k, counting by character class, checking balanced substrings from a fixed start, and splitting into words
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
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
Stack and Monotonic Stack
·6 mins
Algorithm
Stack
Monotonic-Stack
Greedy
Simulation
Parsing nested structures, simulations that interact with the previous element, monotonic stacks, greedy deletion for the smallest string, and a lazy-deletion Max Stack
LeetCode 2751: Robot Collisions
·3 mins
LeetCode
Hard
Stack
Simulation
Sorting
LeetCode 2751 note: sort by position, push right-moving robots, and let each left-moving robot collide until one side is gone
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 3842: Toggle Light Bulbs
·1 min
LeetCode
Easy
Hash-Table
Simulation
Array
LeetCode 3842 note: toggle membership in a set, or keep bulbs appearing an odd number of times, then sort
LeetCode 3838: Weighted Word Mapping
·1 min
LeetCode
Easy
Array
String
Simulation
LeetCode 3838 note: sum each word’s letter weights mod 26 and map backward: 0 -> z, i.e. chr(ord(‘z’) - r)
LeetCode 3834: Merge Adjacent Equal Elements
·2 mins
LeetCode
Medium
Stack
Simulation
Array
LeetCode 3834 note: a stack simulation where a new element merges with an equal top, possibly again with the new top
LeetCode 3379: Transformed Array
·1 min
LeetCode
Easy
Array
Simulation
LeetCode 3379 note: moving nums[i] steps right or left is nums[(i + nums[i]) % n]; Python’s % returns a non-negative result for negatives too
LeetCode 3819: Rotate Non Negative Elements
·1 min
LeetCode
Medium
Array
Simulation
LeetCode 3819 note: pull out the non-negative values, rotate them left by k, and put them back into the non-negative positions in order; with none, do not take a modulo by 0