Easy solution
IntuitionApproachComplexity
Time complexity:O(N)

Space complexity:O(1)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```javascript []
/**
 * @param {number[]} nums
 * @param {number} limit
 * @param {number} goal
 * @return {number}
 */
var minElements = function(nums, limit, goal) {
    let sum = 0;
    for (const n of nums) sum += n;
    let target = Math.abs(goal - sum);
    let res = 0;
    res += Math.floor(target / limit);
    const remain = target % limit;
    return remain > 0 ? res + 1 : res;
};
```
['JavaScript']