CoursesArray Patterns

Sliding Window

Lessons
9
Exercises
56
Minutes
56
  1. 1

    When a Window Slides

    Spot the contiguous-subarray problems where one moving window beats checking every range.

    Multiple choiceTap
    5 exercises
    4 min
  2. 2

    Best Time to Buy and Sell Stock

    Track the cheapest day so far — the window floor — and price every sell against it.

    Complete codeDebugMultiple choiceTrace
    6 exercises
    6 min
  3. 3

    Maximum Average Subarray

    Slide a fixed-size window with one add and one subtract — never re-sum.

    Complete codeDebugMultiple choiceTapTrace
    6 exercises
    6 min
  4. 4

    Longest Substring Without Repeats

    Grow the window right; on a repeat, slide left just past the old copy — never restart from empty.

    Complete codeMultiple choiceTrace
    6 exercises
    6 min
  5. 5

    Permutation in String

    A permutation is just a frequency match — check every fixed-size window with O(1) count updates.

    Complete codeMultiple choiceTrace
    6 exercises
    6 min
  6. 6

    Max Consecutive Ones III

    Don't flip anything — keep a window holding at most k zeros and remember the biggest one you saw.

    Complete codeMultiple choiceTrace
    6 exercises
    6 min
  7. 7

    Sliding Window CheckpointCheckpoint

    No new concepts — combine the island's window rules on fresh inputs: fixed slides, shrink-past-repeat, and the at-most-k budget.

    DebugCode orderFill blankMultiple choiceTrace
    6 exercises
    6 min
  8. 8

    Sliding Window ReviewReview

    Mixed recap of the island: spotting window problems, fixed slides, the running floor, shrink-past-repeat, permutation windows, and the zero budget.

    Complete codeDebugMultiple choiceTapTrace
    7 exercises
    6 min
  9. 9

    Boss: Minimum Window SubstringBoss

    The island's final exam: cover every character of t — duplicates included — with the shortest stretch of s, using an expand-then-shrink window and a need counter for O(1) coverage checks.

    Complete codeDebugCode orderMultiple choiceTrace
    8 exercises
    10 min
AlgoFox Pro

Array Patterns is part of AlgoFox Pro

You can read the whole course outline here. The exercises are in the app, along with your streak, your mistake review, and the progress that carries across your devices.

Pro starts with a 3 day free trial. The app store decides who is eligible for an introductory offer, and a lapsed subscription does not get another one.

Download AlgoFox on the App StoreGet AlgoFox on Google Play

Already subscribed in the app? Sign in with the same account and Pro works here too. Quick Play and Battle are free on the web, and so is the first course in every subject.