Leetcode / 3190. Find Minimum Operations To Make All Elements Divisible By Three
Pick a programming language:
Here is the source code for the solution to this problem.
class Solution {
public int minimumOperations(int[] nums) {
int count = 0;
for (int i = 0; i < nums.length; i++) {
if (nums[i] % 3 != 0) {
count++;
}
}
return count;
}
}
Did you like the lesson? 😆👍
Consider a donation to support our work: