Dsa
Greedy
Easy
Event Speaker Allocation
A conference is hosting several speakers, each requiring a specific duration to present. You have a limited time slot for the event. Write a program to find out the maximum number of speakers that can be allocated to present within the available time.
Input format:
- The first line contains an integer T (total available time).
- The second line contains an integer S (number of speakers).
- The third line contains S space-separated integers (duration each speaker requires).
Output format:
- A single integer, the maximum number of speakers that can fit into the time slot.
Example:
Input:
60
5
15 30 10 20 5
Output:
5
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