dsa1 min read
Shortest Subarray with Sum ≥ K [Hard] — Monotonic Deque on Prefix
Find the shortest subarray with sum >= k, handling negative numbers correctly using a monotonic deque on prefix sums.
Read →
webcoderspeed.com
1276 articles
Find the shortest subarray with sum >= k, handling negative numbers correctly using a monotonic deque on prefix sums.
Find the longest substring containing at most 2 distinct characters using a variable sliding window with a character count map.
Find the longest contiguous subarray of 1s after deleting exactly one element using a sliding window allowing at most one zero.
Sort an array of 0s, 1s, and 2s in one pass using the Dutch National Flag 3-pointer algorithm.
Check if a string can become a palindrome by deleting at most one character using recursive two-pointer palindrome checking.