dsa1 min read
Longest Mountain in Array [Medium] — Two Pass Expand
Find the longest mountain subarray (strictly increasing then decreasing) using two separate forward scans for up and down slopes.
Read →
webcoderspeed.com
1276 articles
Find the longest mountain subarray (strictly increasing then decreasing) using two separate forward scans for up and down slopes.
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.