Dsa
Greedy
Warm-up
Startup Interns
A startup has N interns and M tasks. Each intern has a specific skill level, and each task has a minimum difficulty requirement. An intern can complete a task only if their skill level is greater than or equal to the task's difficulty. Each intern can be assigned at most one task. What is the maximum number of tasks the startup can complete?
Input Format:
Line 1: Space-separated integers representing the skill levels of the interns.
Line 2: Space-separated integers representing the difficulty requirements of the tasks.
Output Format:
Print the maximum number of completed tasks.
Example:
Input:
10 20 30
15 25
Output:
2
(Explanation: Intern with skill 20 takes the task with difficulty 15. Intern with skill 30 takes the task with difficulty 25.)
Key concepts
two pointerssortinggreedy
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