Dsa
Greedy
Easy
Gadget Delivery Scheduling
A company wants to deliver gadgets to different customers, each requiring different delivery times. The company can only handle one delivery at a time. Given the delivery requests with their respective start and end times, determine the maximum number of deliveries that can be completed without any overlap.
Input format:
- The first line contains an integer m (1 ≤ m ≤ 100) - the number of delivery requests.
- The next m lines each contain two integers, start and end (0 ≤ start < end ≤ 500) representing the start and end time of each delivery request.
Output format:
- A single integer representing the maximum number of deliveries that can be completed.
Example:
Input:
5
1 3
2 5
4 6
7 8
3 5
Output:
3
Key concepts
greedyschedulingsorting
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