Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopintervals · sweep-line · overlap-count
The organizer’s problem statement is available at the official source link.
audience overlap
Find the largest audience from entry and exit intervals
Each entry and exit pair is one audience interval; the largest overlap is the maximum audience. Interval endpoints in the diagram are schematic, not task input values.
audience entry/exit 1
0–3
audience entry/exit 2
1–4
audience entry/exit 3
2–5
- 1
Represent each record
An entry time and exit time define one person?s interval in the hall. - 2
Track overlap over time
At each distinct event time, update the number of people inside. - 3
Take the maximum
Return the greatest audience count reached during the programme.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.