dsa1 min read
Longest Turbulent Subarray [Medium] — Two Pointer Direction Track
Find the longest turbulent subarray where comparisons alternate between > and < using two-pointer direction tracking.
Read →
1575 articles
Find the longest turbulent subarray where comparisons alternate between > and < using two-pointer direction tracking.
Count subarrays with exactly K distinct integers using the mathematical trick: exactly(K) = atMost(K) - atMost(K-1).
Find the minimum length substring to replace so that a string of QWER has equal frequencies, using a shrinkable two-pointer approach.
Find minimum character flips to make a binary string alternating by applying a fixed circular sliding window of size n.
Find the maximum number of vowels in any substring of length k using a fixed sliding window with vowel count.