Skip to content

Commit

Permalink
leetcode apple redistribution into boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas committed Mar 11, 2024
1 parent 6a134fd commit c350e88
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions leetcode/algorithms/easy/apple_redistribution_into_boxes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import List


class Solution:
def minimumBoxes(self, apple: List[int], capacity: List[int]) -> int:
n = sum(apple)
capacity.sort(reverse=True)
for i, e in enumerate(capacity):
if e >= n:
return i + 1
n -= e
return 0

0 comments on commit c350e88

Please sign in to comment.