Loading...
Loading...
Loading...
Each student needs a laptop with at least a given screen size. Each laptop can go to one student. Print the largest number of students who can get a laptop that is at least as big as their need.
Example 1
Input
1 2 3 1 1
Output
1
Example 2
Input
3 1 2 1 1 3 2
Output
3
Try the problem first. Open one hint at a time.
Serve the smallest need first with the smallest laptop that fits.
Sort both lists and walk over the laptops with one pointer into the needs.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor