Skills101
← All practice quizzes

Quiz: Interval Problems

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

Many interview questions are about time ranges. Learn the overlap test, merging, inserting, the event sweep for meeting rooms and railway platforms, and the greedy rule for the most non-overlapping meetings.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    When do closed intervals [a1, b1] and [a2, b2] overlap?

  2. Question 2

    Why must intervals be sorted by start before merging?

  3. Question 3

    What does this print?

    out = []
    for s, e in sorted([[5, 7], [1, 4], [2, 3], [6, 8]]):
        if out and s <= out[-1][1]:
            out[-1][1] = max(out[-1][1], e)
        else:
            out.append([s, e])
    print(out)
    
  4. Question 4

    Inserting a new interval into a list that is already sorted and non-overlapping takes how long?

  5. Question 5

    For the minimum platforms problem, what does the running count represent?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →