CoursesArray Patterns

Intervals

Lessons
9
Exercises
56
Minutes
55
  1. 1

    Thinking on a Number Line

    Spot interval problems and learn the master move: sort by start, then sweep once.

    Multiple choiceTap
    5 exercises
    4 min
  2. 2

    Summary Ranges

    Extend a run while numbers stay consecutive — close the range the moment the chain breaks.

    Complete codeMultiple choiceTrace
    6 exercises
    5 min
  3. 3

    Insert Interval

    Three phases, one pass: copy what ends early, absorb every overlap with min/max, copy the rest.

    Complete codeCode orderMultiple choiceTrace
    6 exercises
    6 min
  4. 4

    Interval List Intersections

    Two sorted lists, two pointers: overlap is [max(starts), min(ends)], and only the interval that ends first is finished.

    Complete codeDebugMultiple choiceTrace
    6 exercises
    6 min
  5. 5

    Non-overlapping Intervals

    To remove the fewest intervals, KEEP the most: sort by end and always keep the interval that ends earliest.

    Complete codeMultiple choiceTrace
    6 exercises
    6 min
  6. 6

    Minimum Arrows to Burst Balloons

    The sort-by-end greedy from the other side: shoot at the first end, cover every balloon that starts before it — and here, touching counts.

    Complete codeDebugMultiple choiceTrace
    6 exercises
    6 min
  7. 7

    Intervals CheckpointCheckpoint

    No new concepts — combine the island's interval rules: pick the right sort key, run the overlap test, keep merge bounds honest, and assemble the three-phase insert.

    DebugCode orderFill blankMultiple choiceTrace
    6 exercises
    6 min
  8. 8

    Intervals ReviewReview

    Mixed recap of the island: sort keys, run extension, intersection bounds, the earliest-end greedy, the three-phase insert, and why the sort is the price you pay.

    Complete codeDebugCode orderMultiple choiceTapTrace
    7 exercises
    6 min
  9. 9

    Boss: Merge IntervalsBoss

    The interview classic: sort by start, keep one growing current interval, extend its end with max on every overlap, and emit when the chain breaks.

    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.