
function minimumBoxes(apple: number[], capacity: number[]): number {
const totalApple = apple.reduce((acc, cur) => acc + cur, 0)
const sortedBox = capacity.toSorted((a, b) => b - a)
let needBox = 0
let curCapacity = 0
for(const capacity of sortedBox) {
curCapacity += capacity
needBox++
if(curCapacity >= totalApple) break
}
return needBox
};