Simple 3 Lines C++
Intuition + Approach\n Describe your first thoughts on how to solve this problem. \nThe intuition is to compare the initial sum of the array\'s elements s with 
# Intuition + Approach\n<!-- Describe your first thoughts on how to solve this problem. -->\nThe intuition is to compare the initial sum of the array\'s elements `s` with the target sum `goal`. Then, since we know how big (or small) can each integer be, we can compute the missing amount of integers to insert with a simple formula.\n\nThis is approach is correct since we need to find the smallest amount of integers to add to the array, so the most convenient choice to do is to add the maximum integer `limit` for (`missing`/`limit`) times, and, if we still haven\'t reached the target `goal`, then one more integer (which would have the value `goal`-`missing`/`limit`).\n\n# Complexity\n- Time complexity: $$O(n)$$ for the sum.\n- Space complexity: $$O(1)$$.\n\n# Code\n```\nclass Solution {\npublic:\n    int minElements(vector<int>& nums, int limit, int goal) {\n        long long s = accumulate(nums.begin(), nums.end(), 0LL);\n        long long missing = abs(goal - s);\n        return (missing + limit - 1) / limit; \n    }\n};\n```
['C++']