Leetcode 1911 Solution
This article provides solution to leetcode question 1911 (minimum-elements-to-add-to-form-a-given-sum)
Access this page by simply typing in "lcs 1911" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
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