Dsa
Greedy
Easy
Parcel Delivery
You are tasked with scheduling the delivery of parcels to different locations. Each location has a designated time window during which the parcel can be delivered. Given a list of time windows for each location, your goal is to maximize the number of parcels delivered. Each time window is a pair of integers [start, end]. You cannot deliver to overlapping time windows.
Input:
The first line contains an integer n (1 ≤ n ≤ 1000) - the number of locations.
The next n lines contain two integers each (0 ≤ start < end ≤ 10000) representing the time windows.
Output:
Print the maximum number of locations that can receive parcels delivered within their time windows.
Example:
Input:
3
1 4
2 5
5 6
Output:
2
Key concepts
greedysortinginterval
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