Array
LeetCode 3708: Longest Fibonacci Subarray
·1 min
LeetCode
Medium
Array
LeetCode 3708 note: lengths 1 and 2 always work; from the third element, extend while nums[i] == nums[i-1] + nums[i-2], otherwise reset to 2
LeetCode 3701: Compute Alternating Sum
·1 min
LeetCode
Easy
Array
Simulation
LeetCode 3701 note: add even indices and subtract odd ones; with slices, sum(nums[::2]) - sum(nums[1::2])
LeetCode 3697: Compute Decimal Representation
·1 min
LeetCode
Easy
Math
Array
LeetCode 3697 note: each non-zero digit times its place value is one component; output them from the highest place down
LeetCode 3689: Maximum Total Subarray Value I
·1 min
LeetCode
Medium
Greedy
Array
LeetCode 3689 note: the same subarray may be chosen repeatedly, and the whole array’s max minus min is the best single value, so choose it k times
LeetCode 3688: Bitwise OR of Even Numbers in an Array
·1 min
LeetCode
Easy
Bit-Manipulation
Array
Simulation
LeetCode 3688 note: OR only the even numbers; the starting value 0 is also the answer when there are none
LeetCode 2294: Partition Array Such That Maximum Difference Is K
·1 min
LeetCode
Medium
Greedy
Sorting
Array
LeetCode 2294 note: subsequences ignore order, so sort and extend each group from its minimum until a value exceeds min + k
LeetCode 1493: Longest Subarray of 1's After Deleting One Element
·2 mins
LeetCode
Medium
Sliding-Window
Dynamic-Programming
Array
LeetCode 1493 note: find the longest window with at most one 0; since one element must be deleted, the answer is the window length minus 1
LeetCode 3195: Find the Minimum Area to Cover All Ones I
·1 min
LeetCode
Medium
Array
Matrix
LeetCode 3195 note: track the topmost, bottommost, leftmost and rightmost 1; the area is height times width
LeetCode 3649: Number of Perfect Pairs
·2 mins
LeetCode
Medium
Two-Pointers
Math
Sorting
Array
LeetCode 3649 note: simplify the condition to “larger absolute value <= 2 × smaller absolute value”, then count with two pointers over sorted absolute values
LeetCode 853: Car Fleet
·2 mins
LeetCode
Daily
Medium
Array
Stack
Greedy
Simulation
Sorting
Solving the Car Fleet problem using stack-based approach
LeetCode 84: Largest Rectangle in Histogram
·3 mins
LeetCode
Daily
Hard
Array
Stack
Monotonic-Stack
Dynamic-Programming
Geometry
Histogram
Solving the Largest Rectangle in Histogram problem using monotonic stack approach
LeetCode 739: Daily Temperatures
·2 mins
LeetCode
Daily
Medium
Array
Stack
Monotonic-Stack
Data-Structures
Temperature
Waiting-Time
Solving the Daily Temperatures problem using monotonic stack approach