Sliding Window
Use for longest/shortest subarray satisfying constraint, distinct chars, “at most K” style.
What this pattern is
Use a moving subarray/substring boundary to maintain a property (e.g., counts, distinctness) while expanding/contracting pointers in O(n).
Exercise: lengthOfLongestSubstring
Task: Return the length of the longest substring without repeating characters.
Example: "abcabcbb" → 3 ("abc"); "bbbbb" → 1 ("b")
Edge cases: empty string, long runs of same char.
Your Solution
Exercise: minWindow
Task: Given strings s and t, return the minimum window in s that contains all chars of t with multiplicity. If no window, return "".
Example: s="ADOBECODEBANC", t="ABC" → "BANC"
Edge cases: t longer than s, repeated chars in t.