We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 12195f5 commit 171db69Copy full SHA for 171db69
C++/minimum-operations-to-make-array-sum-divisible-by-k.cpp
@@ -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