Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

The Quiet Calendar

Learn
Play
Prove
Problem context and objectives
Mission briefing

Puzzle systems engineer · A game mechanic is behaving incorrectly

Remove the fewest conflicting requests: The Quiet Calendar.

Brute force may pass the demo but fail when the world fills with players.

How you win

  1. 1Recognize when Earliest-finish interval scheduling matches the clues
  2. 2Keep this true after every move: kept intervals are compatible and have the earliest possible final end for their count
  3. 3Reach the result within O(n log n)

Rules and pressure

  • Target cost: O(n log n)
  • State rule: kept intervals are compatible and have the earliest possible final end for their count
Lesson 1 of 3

Live algorithm trace

Earliest-finish interval scheduling

Complete execution
1 of 6

Sort by end time, placing 1-2 first.

1sort intervals by end
2lastEnd = negative infinity
3keep if start >= lastEnd
4otherwise remove
5return removal count
order = by endremoved = 0
Truth to preserve / Cost target
Truth to preserve

kept intervals are compatible and have the earliest possible final end for their count

Cost target

O(n log n)

Sort by finishing time and keep every interval whose start reaches the last kept end. Earliest finish leaves at least as much room for all future choices as any alternative.

Your call · What should guide every step of this algorithm?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead