Dsa
Intervals
Easy
Maximal Shifts in Work Schedule
A company has a work schedule divided into shifts represented as intervals (start, end). The same employee can't work overlapping shifts. Given a list of shifts, count the maximum number of non-overlapping shifts that can be scheduled. Each shift is defined by two integers on a single line, start and end. Output a single line with the maximum number of non-overlapping shifts.
Example:
Input:
1 3
2 4
3 5
6 8
Output:
3
Key concepts
intervalscountingscheduling
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