Day 321 of DSA
๐ LeetCode 424 โ Longest Repeating Character Replacement
Sliding Window + HashMap
Key formula:
window_size - max_freq <= k
Track frequencies, expand right, and shrink left when replacements exceed k.
Interesting pattern, but edge cases need more practice!
#DSA
2
Day 317 of DSA
๐ LeetCode 904 โ Fruit Into Baskets
Variable-size Sliding Window:
Use a hashmap to track fruit frequencies.
Expand right to add fruits.
If distinct fruit types exceed 2, shrink from left.
Remove keys when their frequency reaches zero.
Track the maximum window len
1
9
Day 316 of DSA
๐ LeetCode 1456 โ Maximum Number of Vowels in a Substring of Given Length
Fixed-size Sliding Window:
Count vowels in the first k characters.
Remove the outgoing character's contribution.
Add the incoming character's contribution.
Track the maximum count.
#DSA
1
4
Day 315 of DSA
๐ LeetCode 239 โ Sliding Window Maximum
Brute force: Find the maximum in every window.
Optimized: Monotonic decreasing Deque.
Store indices, not values.
Remove expired indices.
Remove smaller elements from the back.
Front always holds the current maximum.
#DSA
1
8

















