LeetCode solutions

3476. Find Minimum Operations to Make All Elements Divisible by Three

My accepted C++ solution to LeetCode problem 3476, Find Minimum Operations to Make All Elements Divisible by Three, running in 0ms.

  • Difficulty: Easy
  • C++
  • Runtime 0ms
  • Memory 23.4MB

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 23.4MB, accepted 2025-12-27.

cpp
class Solution {
    public:
    int minimumOperations(vector<int>& nums) {
        int count = 0;
        for (int n : nums) if (n % 3 != 0) count++;
        return count;
    }
};

Source