You are given two arrays of integers,
fruitsandbaskets, each of lengthn, wherefruits[i]represents the quantity of theithtype of fruit, andbaskets[j]represents the capacity of thejthbasket.From left to right, place the fruits according to these rules:
- Each fruit type must be placed in the leftmost available basket with a capacity greater than or equal to the quantity of that fruit type.
- Each basket can hold only one type of fruit.
- If a fruit type cannot be placed in any basket, it remains unplaced.
Return the number of fruit types that remain unplaced after all possible allocations are made.
1 | class Solution { |