dsa1 min read
Sort Vowels in a String [Medium] — Extraction and Replace
Sort only the vowels in a string while keeping consonants in place by extracting vowels, sorting, then reinserting.
Read →
1575 articles
Sort only the vowels in a string while keeping consonants in place by extracting vowels, sorting, then reinserting.
Find the minimum window in s that contains t as a subsequence by using a forward pass to find a valid window then backward pass to minimize it.
Count subarrays where the median is exactly k by converting the problem to counting balanced prefix sequences around k.
Find the median of each sliding window of size k using two heaps (max-heap for lower half, min-heap for upper half) with lazy deletion.
Find all starting indices of substrings that are concatenations of all given words using a sliding window for each possible word-aligned start.