Hash-Table
LeetCode 1763: Longest Nice Substring
·2 mins
LeetCode
Easy
Sliding-Window
Divide-and-Conquer
Hash-Table
String
Bit-Manipulation
LeetCode 1763 note: a character whose other case never appears cannot be in the answer, so split on it and recurse, preferring the left side on ties
LeetCode 2781: Length of the Longest Valid Substring
·3 mins
LeetCode
Hard
Sliding-Window
Hash-Table
String
Trie
LeetCode 2781 note: forbidden words are at most 10 long, so each right end checks only the last 10 suffixes; on a match push the left end past it, using the shortest match (the rightmost start)
LeetCode 2009: Minimum Number of Operations to Make Array Continuous
·2 mins
LeetCode
Hard
Sliding-Window
Hash-Table
Binary-Search
Array
LeetCode 2009 note: the result is n consecutive integers; after deduplicating and sorting, a sliding window finds the most distinct values within a span of n - 1, and the rest must change
LeetCode 3805: Count Caesar Cipher Pairs
·2 mins
LeetCode
Medium
Math
Hash-Table
String
Counting
LeetCode 3805 note: shift each string so its first letter is a, making Caesar-equivalent strings identical, then count pairs per normalized form
LeetCode 3804: Number of Centered Subarrays
·1 min
LeetCode
Medium
Hash-Table
Enumeration
Array
LeetCode 3804 note: fix the left end and extend right, adding to the sum and to a set; count the subarray when the sum is in the set
LeetCode 3803: Count Residue Prefixes
·1 min
LeetCode
Easy
Hash-Table
String
LeetCode 3803 note: add characters to a set while scanning; count a prefix when its distinct count equals its length % 3
LeetCode 2831: Find the Longest Equal Subarray
·2 mins
LeetCode
Medium
Sliding-Window
Hash-Table
Binary-Search
Array
LeetCode 2831 note: list the positions of each value and slide a window over that list; the deletions needed are the span of positions minus the number of copies
LeetCode 2516: Take K of Each Character From Left and Right
·2 mins
LeetCode
Medium
Sliding-Window
Hash-Table
String
LeetCode 2516 note: taking from both ends leaves a middle block in which each letter may appear at most total − k times; find the longest such window
LeetCode 3090: Maximum Length Substring With Two Occurrences
·1 min
LeetCode
Easy
Sliding-Window
Hash-Table
String
LeetCode 3090 note: a longest-window slide that shrinks the left whenever the newly added character appears more than twice
LeetCode 2958: Length of Longest Subarray With at Most K Frequency
·1 min
LeetCode
Medium
Sliding-Window
Hash-Table
Array
LeetCode 2958 note: a longest-window slide that shrinks the left whenever the newly added number appears more than k times
LeetCode 1461: Check If a String Contains All Binary Codes of Size K
·2 mins
LeetCode
Medium
Hash-Table
String
Bit-Manipulation
Rolling-Hash
LeetCode 1461 note: put every length-k substring in a set and check that its size reaches 2^k; the last start is len(s) - k
LeetCode 2953: Count Complete Substrings
·3 mins
LeetCode
Hard
Sliding-Window
Hash-Table
String
LeetCode 2953 note: split where neighboring letters differ by more than 2; in each segment enumerate the number of distinct letters d, slide a fixed window of d × k, and track how many letters appear exactly k times