lockers, from left to right. A courier loads parcels strictly in the order of parcels, where parcels[i] is the size of the i-th parcel.
Each parcel goes into the **leftmost free** locker whose capacity is at least the parcel's size. A locker holds only one parcel. If no free locker fits, the parcel stays with the courier and they move on to the next one.
Return how many parcels end up not placed.parcels=[6, 2, 9], lockers=[3, 7, 8] → 1
Parcel 6 goes into locker 7 (locker 3 is too small), parcel 2 goes into locker 3, and parcel 9 fits nowhere, since only locker 8 is left. One parcel is left over.
parcels=[1, 5], lockers=[5, 2] → 1
Parcel 1 takes the leftmost locker that fits, which is 5. Parcel 5 is left with locker 2 only and does not fit, even though another assignment would have placed both.
parcels=[4, 4, 4], lockers=[4, 10, 4] → 0
parcels=[6, 2, 9], lockers=[3, 7, 8]
1
Run checks the first 3 tests in your browser. Submit checks all 110 tests on the server, hidden ones included.