Practice Apple Redistribution into Boxes
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an array apple of size n and an array capacity of size m. There are n packs where the ith pack contains apple[i] apples. There are m boxes as well, and the ith box has a capacity of capacity[i] apples. Return the minimum number of boxes you need to select to redistribute these n packs of apples into boxes. Note that, apples from the same pack can be distributed into different boxes.
Source: Apple Redistribution into Boxes on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
apple = [1,3,2], capacity = [4,3,1,5,2]
2
# Example 2
apple = [5,5,5], capacity = [2,4,2,7]
4
Constraints
Related LeetCode Problems
Practice more problems similar to Apple Redistribution into Boxes.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.