All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : May 23, 2024
Last updated : July 01, 2024
Related Topics : Array, Greedy, Sorting
Acceptance Rate : 67.69 %
class Solution:
def minimumBoxes(self, apple: List[int], capacity: List[int]) -> int:
sumapp = sum(apple)
heapq._heapify_max(capacity)
counter = 0
while sumapp > 0 :
sumapp -= heapq._heappop_max(capacity)
counter += 1
return counter