C++ | greedy | fast
\n\n# Code\n\nclass Solution {\npublic:\n       int minElements(vector<int>& A, int limit, int goal) {\n        long sum = accumulate(A.begin(), A.end(), 0L),  
\n\n# Code\n```\nclass Solution {\npublic:\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```
['C++']