Skip to content

Commit 171db69

Browse files
authored
Create minimum-operations-to-make-array-sum-divisible-by-k.cpp
1 parent 12195f5 commit 171db69

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Time: O(n)
2+
// Space: O(1)
3+
4+
// math
5+
class Solution {
6+
public:
7+
int minOperations(vector<int>& nums, int k) {
8+
return accumulate(cbegin(nums), cend(nums), 0) % k;
9+
}
10+
};

0 commit comments

Comments
 (0)