Shortest Sub{string,array}
Usually, both expansion and shrinking will be having while loop, and condition for shrink will just be the complement/negation/opposite of expansion.
Naive
while expand + while shrink
209. Minimum Size Subarray Sum
2260. Minimum Consecutive Cards to Pick Up
Medium1 solutionexplanationanalysis1 playground
Solutions:
Trace Engine
Two Strings
while expand + while shrink
76. Minimum Window Substring
Smallest window containing 0, 1 and 2
Easy1 solutionexplanationanalysis1 playground
Solutions: