dsa1 min read
Longest Substring with At Most Two Distinct Characters [Hard]
Find the longest substring containing at most 2 distinct characters using a variable sliding window with a character count map.
Read →
1575 articles
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.
Check if an array can be split into three consecutive parts with equal sum using a greedy counting approach.