Minimum Window Substring
Expand until the window covers all required characters, then shrink while it still does.
Substring Windows: Smallest window covering abc
r = 0, 'a' enters. It was still needed, so missing drops to 2.
Cost
- Best
- O(n)
- Average
- O(n + m)
- Worst
- O(n + m)
- Space
- O(alphabet)
Before this
Taught by the same lesson
Substring Windows covers these too, in the same run.