Two-Pointers
LeetCode 1498: Number of Subsequences That Satisfy the Given Sum Condition
·2 mins
LeetCode
Medium
Two-Pointers
Sorting
Binary-Search
Array
LeetCode 1498 note: only the minimum and maximum matter, so order does not and we can sort; fixing nums[left] as the minimum, the elements between are free, giving 2^(right - left) choices
LeetCode 1712: Ways to Split Array Into Three Subarrays
·4 mins
LeetCode
Medium
Binary-Search
Prefix-Sum
Two-Pointers
LeetCode 1712 note: fix the first cut and find the valid range of the second cut with two bisects or two monotonic pointers
LeetCode 825: Friends Of Appropriate Ages
·3 mins
LeetCode
Medium
Two-Pointers
Sorting
Binary-Search
Array
LeetCode 825 note: after sorting, the people someone can invite have ages in (0.5 × age + 7, age], a contiguous range kept with two same-direction pointers, minus the person themself
LeetCode 2200: Find All K-Distant Indices in an Array
·2 mins
LeetCode
Easy
Two-Pointers
Array
LeetCode 2200 note: extend each key k positions both ways, and keep a pointer to how far output has gone so overlapping ranges are not emitted twice
LeetCode 3794: Reverse String Prefix
·2 mins
LeetCode
Easy
Two-Pointers
String
LeetCode 3794 note: one line with slicing; a hand-written two-pointer version must convert the string to a list first
LeetCode 3750: Minimum Number of Flips to Reverse Binary String
·2 mins
LeetCode
Easy
Two-Pointers
Bit-Manipulation
String
LeetCode 3750 note: compare the binary string with its reverse bit by bit; the number of mismatches is the answer
LeetCode 2300: Successful Pairs of Spells and Potions
·2 mins
LeetCode
Medium
Binary-Search
Sorting
Two-Pointers
LeetCode 2300 note: sort potions, bisect a threshold per spell, and compute the threshold with integer ceil to avoid float error
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 3643: Flip Square Submatrix Vertically
·2 mins
LeetCode
Easy
Two-Pointers
Matrix
LeetCode 3643 note: flip only the submatrix rows, swapping the slices of rows x + i and x + k - 1 - i
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 30: Substring with Concatenation of All Words (Brute Force → Counting → Sliding Window)
·3 mins
LeetCode
Daily
Hard
String
Sliding-Window
Two-Pointers
Hash-Map
Brute-Force
Frequency-Counting
Three approaches: brute force, counting optimization, and sliding window over word-length offsets.
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.