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
The organizer’s problem statement is available at the official source link.
interval overlap
Shared cakes are interval overlaps
Two children conflict exactly when their closed intervals share a cake; one allowed edit may relocate one equal-length interval.
interval 1
0–3
interval 2
1–4
- 1
Detect conflicts
Sort interval endpoints and identify every overlapping pair. - 2
Try one relocation
With no edit, any overlap means conflict. - 3
Check all intervals
For one edit, test whether an interval of the same length can be placed in a free span without creating overlap.
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.