- Longest Substring With At Most K Distinct Characters
- 02 April, 2026: 00.06.39 ✔
- Subarrays with K Different Integers
- 02 April, 2026: 00.16.35 ❌
- Failed at edge cases
- Count leading zeros
- Traditional sliding window fail
- Mistake:
- Confused with Binary Subarray Sum problem
- Used sum-based reasoning (incorrect)
- Key Insight:
- Problem is about DISTINCT elements, not sum
- Sliding window works because:
- We can track distinct count using hashmap
- When distinct > k → shrink window deterministically
- Minimum Window Substring
- 04 April, 2026: 00.29.19 ❌
- Failed at implementation
- Extend: On each itration.
- Shrink: If no item left
- Minimum Window Subsequence
- 06 April, 2026: 00.40.44 ❌
- Doesn't follow sliding window template.
substr(start, length) → second parameter is length, not ending index.
- Correct Approach:
For every possible start:
- Go forward → find a valid subsequence match
- Go backward → shrink the window to make it minimal (remove duplicates)
- Update answer