You are given two integer arrays, fruits and baskets, each of length n.
fruits[i] represents the quantity of the
baskets[j] represents the capacity of the
Place the fruit types into baskets from left to right using the following rules:
Each fruit type must be placed in the leftmost available basket whose capacity is greater than or equal to its quantity.
Each basket can hold only one type of fruit.
If a fruit type cannot be placed in any available basket, it remains unplaced.
Return the number of fruit types that remain unplaced after all possible allocations are made.
Constraints:
n == fruits.length == baskets.length
n
fruits[i], baskets[i]
You are given two integer arrays, fruits and baskets, each of length n.
fruits[i] represents the quantity of the
baskets[j] represents the capacity of the
Place the fruit types into baskets from left to right using the following rules:
Each fruit type must be placed in the leftmost available basket whose capacity is greater than or equal to its quantity.
Each basket can hold only one type of fruit.
If a fruit type cannot be placed in any available basket, it remains unplaced.
Return the number of fruit types that remain unplaced after all possible allocations are made.
Constraints:
n == fruits.length == baskets.length
n
fruits[i], baskets[i]