Easy than expected - Java O(N)|O(1)
Intuition\n Describe your first thoughts on how to solve this problem. \nSimply follow the description, the only trick is Integer overflow, use Long for sum.\n\
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nSimply follow the description, the only trick is `Integer` overflow, use `Long` for sum.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass Solution {\n    public int minElements(int[] nums, int limit, int goal) {\n        long sum = 0;\n        for (int val : nums)\n            sum += val;\n        return (int)(Math.abs(goal - sum) / Math.abs(limit) + (Math.abs(goal - sum) % Math.abs(limit) == 0 ? 0 : 1));\n    }\n}\n```
['Java']