“Maximum consecutive something”/“Maximum Substring” ⇒ think sliding window.

  • Sliding windows can stretch or shrink in length
  • It’s a kind of greedy algorithm
  • you can do many things in time.
  • It can do flipping and stuff too!

Example of complex sliding window problem: #1004 - Maximum Consecutive Ones with Flipping