1785. Minimum Elements to Add to Form a Given Sum

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1785

class Solution:
    def minElements(self, nums: List[int], limit: int, goal: int) -> int:
        d = abs(sum(nums) - goal)
        return (d + limit - 1) // limit