Sliding window and two pointers
Sliding window
Use when you need a contiguous subset of an array or string.
Problems to practice
- Longest substring without repeating characters
- Maximum sum subarray of fixed size
- Minimum window substring
- Fruits into baskets
- Permutation in string
Two pointers
Use when you need to scan from both ends or move indices in different directions.
Problems to practice
- Valid palindrome
- Container with most water
- Merge sorted arrays
- Remove duplicates from sorted array
Can you explain it without the notes?
Sliding window and two pointers
Use your own words. Explain an example and one limitation before checking the explanation.
Check your explanation
Sliding window
Turn this concept into a clear answer.
Practice this conceptAdapted from 14_DSA_MASTER.md · “15. Sliding window and two pointers”. Examples are study fragments; framework behavior can depend on your version.