2279. Maximum Bags With Full Capacity of Rocks
On This Page
class Solution:
def maximumBags(
self, capacity: List[int], rocks: List[int], additionalRocks: int
) -> int:
d = [a - b for a, b in zip(capacity, rocks)]
d.sort()
res = 0
for v in d:
if v <= additionalRocks:
res += 1
additionalRocks -= v
return res