Dsa
Intervals
Easy
Interval Scheduling Maximization
You are given a list of intervals representing tasks, where each interval is defined by a start and end time. Your goal is to find the maximum number of non-overlapping tasks that can be scheduled. You can assume that tasks cannot be executed at the same time.
Input format:
- First line contains an integer n (1 ≤ n ≤ 100): number of tasks.
- The next n lines, each containing two integers start and end, separated by a space (0 ≤ start < end ≤ 10^9).
Output format:
- Print a single integer representing the maximum number of non-overlapping tasks that can be scheduled.
Example:
Input:
4
1 3
2 5
4 6
7 8
Output:
3
Key concepts
intervalsschedulinggreedy
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