LeetCode
LeetCode 3800: Minimum Cost to Make Two Binary Strings Equal
·2 mins
LeetCode
Medium
Greedy
String
LeetCode 3800 note: split mismatches into two kinds; pair different kinds with a swap, same kinds with cross + swap, flip any leftover, and compare each against two flips
LeetCode 3799: Word Squares II
·2 mins
LeetCode
Medium
Backtracking
Enumeration
String
LeetCode 3799 note: four nested levels pruned by corner letters; sorting the words first makes the output lexicographic
LeetCode 3798: Largest Even Number
·1 min
LeetCode
Easy
String
LeetCode 3798 note: parity depends only on the last digit, so just delete trailing 1s; keeping more digits is larger
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
LeetCode 2269: Find the K-Beauty of a Number
·2 mins
LeetCode
Easy
Sliding-Window
Math
String
LeetCode 2269 note: convert the number to a string and check every length-k substring; 0 cannot be a divisor
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 2156: Find Substring With Given Hash Value
·3 mins
LeetCode
Hard
Sliding-Window
Rolling-Hash
String
LeetCode 2156 note: the first character has weight p^0, so sliding right to left needs only multiply by p, add the new character, and subtract the outgoing one times p^k; the modulus may not be prime, so no modular inverse
LeetCode 1016: Binary String With Substrings Representing 1 To N
·3 mins
LeetCode
Medium
Sliding-Window
String
Bit-Manipulation
Hash-Table
LeetCode 1016 note: s has at most 1000 characters, so there are few substrings of any fixed length and a large n must be False; checking from n downward fails fast, or extend up to 30 bits from each start to collect every value <= n
LeetCode 3796: Find Maximum Value in a Constrained Sequence
·2 mins
LeetCode
Medium
Greedy
Array
LeetCode 3796 note: each position’s bound is the min of its own limit, the left bound + difference and the right bound + difference; one pass each way
LeetCode 3795: Minimum Subarray Length With Distinct Sum At Least K
·2 mins
LeetCode
Medium
Sliding-Window
Hash-Table
Array
LeetCode 3795 note: a shortest-window slide where each value counts once; track each value’s last position, and subtract the left value only if it was the last occurrence
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 2653: Sliding Subarray Beauty
·2 mins
LeetCode
Medium
Sliding-Window
Hash-Table
Array
LeetCode 2653 note: values are only -50 to 50, so the fixed window keeps a count array, and each window accumulates upward from -50 to find the x-th smallest negative