Dsa
Greedy
Medium
Adventure Park Attractions
You are managing an adventure park with several attractions. Each attraction has a start and end time during which it operates. You want to schedule the most attractions for a day without any overlap. To maximize the number of attractions, you need to select the maximum number of intervals (attractions) that do not overlap.
Input Format:
- The first line contains an integer `n` (the number of attractions).
- The next `n` lines contain two integers each: `start_i` and `end_i`, representing the start and end times of the i-th attraction.
Output Format:
- Print the maximum number of attractions you can schedule.
Example:
Input:
5
1 3
2 5
4 6
6 7
5 8
Output:
3
Key concepts
greedysortingintervals
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now