Leetcode 3479. Fruits Into Baskets III
Assign each fruit, left-to-right, to the leftmost unused basket whose capacity is at least the fruit's quantity (each basket holds one fruit type); return how many fruits remain unplaced. This is a greedy first-fit matching problem that for large n requires a data structure (e.g., segment tree/ordered set) to quickly find the first qualifying available basket.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Your account is free and you can post anonymously if you choose.