Skip to main content

Interval sweeps · 5 minutes

Measure occupied room-minutes

Get feedback on your answer. No account needed.

What does this Python code print?

changes = [(0, 1), (3, 1), (5, -1), (7, -1)]
last = active = total = 0
for minute, delta in changes:
    total += active * (minute - last)
    active += delta
    last = minute
print(total)

Enter the output on one line.

Your answer
Need a small hint?

Use the old occupancy for each stretch between two events.

This helps us choose when to schedule your next review.