Dsa
Dynamic Programming
Easy
Optimal Project Selection
You are given n projects, each defined by a start time and an end time. Your goal is to select the maximum number of non-overlapping projects. Calculate the maximum number of projects you can accept without any overlap.
Input:
- The first line contains an integer n (1 <= n <= 1000).
- The next n lines contain two integers representing the start and end times of each project.
Output:
- A single integer representing the maximum number of projects.
Example:
Input:
4
1 3
2 5
4 6
5 7
Output:
3
Key concepts
dynamic_programminginterval_scheduling
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