Efficientive algorithm:

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. – Antoine de Saint-Exupéry

The following return values can use a sliding window:

  1. Minimum value
  2. Maximum value
  3. Longest value
  4. Shortest value
  5. K-sized value

And contiguous is one of the biggest clues.

Common data structures are strings, arrays and even linked lists.

Framework:

  1. Slide right window to move forward
  2. Slide left window to meet the requirements.
  3. Compare to result.