Fruits Into Baskets II
You are given two integer arrays,
fruits and baskets, both of length n. Each fruits[i] represents the weight of the i-th fruit, and each baskets[j] represents the capacity of the j-th basket. You need to process the fruits in the order they appear in the input (from index 0 to n-1). For each fruit, place it in the leftmost available basket that has a capacity greater than or equal to the fruit's weight. Once a fruit is placed in a basket, that basket becomes unavailable for any subsequent fruits. Return the total number of fruits that cannot be placed in any basket. Constraints: n == fruits.length == baskets.length 1 \le n \le 10^5 1 \le fruits[i], baskets[j] \le 10^9JavaSegment TreeBinary Search
00