C++ | Easy to Understand Solution O(n)
class Solution {\npublic:\n    int minElements(vector& nums, int limit, int goal) {\n        long long sum = 0;\n        for(int i=0;i<nums.size();i++){\n      
class Solution {\npublic:\n    int minElements(vector<int>& nums, int limit, int goal) {\n        long long sum = 0;\n        for(int i=0;i<nums.size();i++){\n            sum += nums[i];\n        }\n        if(sum == goal){\n            return 0;\n        }\n        long long diff = abs(goal-sum);\n        long long ans = diff/limit;\n        if(diff%limit==0){\n            return ans;\n        }\n        return ans+1;\n    }\n};
['C']