Dsa
Greedy
Medium
Maximum Non-overlapping Intervals
You are given a series of time intervals representing meetings that need to be scheduled. Your goal is to select the maximum number of non-overlapping meetings possible. The meetings have start and end times, and you can only attend one meeting at a time.
Input Format:
- The first line contains an integer `n` (the number of meetings).
- The next `n` lines contain two integers each: `start_i` and `end_i`, representing the start and end times of the i-th meeting.
Output Format:
- Print the maximum number of meetings that can be attended without overlap.
Example:
Input:
4
1 2
2 3
3 4
4 5
Output:
4
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