[Java/C++/Python] Clean Greedy Solution
Explanation\nCalculate the difference we need to change diff = abs(sum(A) - goal))\nWe can change at most limit once\nResult is the integer ceil of fraction dif
# **Explanation**\nCalculate the difference we need to change `diff = abs(sum(A) - goal))`\nWe can change at most limit `once`\nResult is the integer ceil of fraction `diff / limit`.\nIn math it equals to `(diff + limit - 1) / limit`\n<br>\n\n# **Complexity**\nTime `O(n)`\nSpace `O(1)`\n<br>\n\n**Java**\n```java\n    public int minElements(int[] A, int limit, int goal) {\n        long sum = 0, diff;\n        for (int a : A)\n            sum += a;\n        diff = Math.abs(goal - sum);\n        return (int)((diff + limit - 1) / limit);\n    }\n```\n**C++**\n```cpp\n    int minElements(vector<int>& A, int limit, int goal) {\n        long sum = accumulate(A.begin(), A.end(), 0L),  diff = abs(goal - sum);\n        return (diff + limit - 1) / limit;\n    }\n```\n**Python**\n```py\n    def minElements(self, A, limit, goal):\n        return (abs(sum(A) - goal) + limit - 1) / limit\n```\n
[]