Dsa
Intervals
Medium
Task Scheduling
You are given a list of tasks represented by intervals (start, end). Your task is to find the maximum number of non-overlapping tasks that can be scheduled. Output this number.
Input Format:
- An integer n (1 ≤ n ≤ 1000), the number of tasks.
- Followed by n lines, each containing two integers start and end (0 ≤ start < end ≤ 10^9).
Output Format:
- An integer representing the maximum number of non-overlapping tasks.
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