Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 914 Bytes

_3074. Apple Redistribution into Boxes.md

File metadata and controls

38 lines (27 loc) · 914 Bytes

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : May 23, 2024

Last updated : July 01, 2024


Related Topics : Array, Greedy, Sorting

Acceptance Rate : 67.69 %


Solutions

Python

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