Sliding-Window
LeetCode 438: Find All Anagrams in a String
·4 mins
LeetCode
Daily
Medium
String
Sliding-Window
Hash-Map
Anagram
Frequency-Counting
LeetCode Problem Solving - Sliding Window with Character Frequency
LeetCode 3: Longest Substring Without Repeating Characters
·2 mins
LeetCode
Daily
Medium
Sliding-Window
Hash-Map
LeetCode Problem Solving
LeetCode 2090: K Radius Subarray Averages
·2 mins
LeetCode
Daily
Medium
Sliding-Window
LeetCode Problem Solving
LeetCode 1343: Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold
·3 mins
LeetCode
Daily
Medium
Array
Sliding-Window
Prefix-Sum
Average-Calculation
LeetCode Problem Solving - Fixed Size Sliding Window with Sum Calculation
LeetCode 1248: Count Number of Nice Subarrays
·3 mins
LeetCode
Medium
Sliding-Window
Prefix-Sum
Hash-Table
Array
LeetCode 1248 note: “exactly k odd numbers” is not monotonic, so compute “at most k” minus “at most k - 1”; or use prefix sums with a hash map
Sliding Window
·8 mins
Algorithm
Sliding-Window
Two-Pointers
Hash-Table
Monotonic-Queue
Fixed-size windows, variable windows for longest / shortest, counting subarrays (at most K minus at most K - 1, count += left for at least K), and monotonic deques for window extremes
LeetCode 2799: Count Complete Subarrays in an Array
·2 mins
LeetCode
Daily
Medium
Sliding-Window
LeetCode Problem Solving
LeetCode 187: Repeated DNA Sequences
·1 min
LeetCode
Medium
Hash-Table
String
Bit-Manipulation
Sliding-Window
LeetCode 187 note: count every length-10 substring in a hash map and return those seen more than once
LeetCode 424: Longest Repeating Character Replacement
·2 mins
LeetCode
Medium
Hash-Table
String
Sliding-Window
LeetCode 424 note: a variable sliding window where window length minus the top character count is the number of replacements; shrink when it exceeds k
LeetCode 594: Longest Harmonious Subsequence
·1 min
LeetCode
Easy
Array
Hash-Table
Sliding-Window
Sorting
LeetCode 594 note: subsequences need not be contiguous, so just count; for each x add the counts of x and x + 1
LeetCode 219: Contains Duplicate II
·2 mins
LeetCode
Easy
Array
Hash-Table
Sliding-Window
LeetCode 219 note: a hash map stores each value’s last index; only the most recent occurrence needs a distance check