Leetcode 1911 Solution

This article provides solution to leetcode question 1911 (minimum-elements-to-add-to-form-a-given-sum)

https://leetcode.com/problems/minimum-elements-to-add-to-form-a-given-sum

Solution

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