Array Math 3190. Find Minimum Operations to Make All Elements Divisible by Three ¶ Time: $O(n)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6class Solution { public: int minimumOperations(vector<int>& nums) { return ranges::count_if(nums, [](int num) { return num % 3 != 0; }); } }; 1 2 3 4 5class Solution { public int minimumOperations(int[] nums) { return (int) Arrays.stream(nums).filter(num -> num % 3 != 0).count(); } } 1 2 3class Solution: def minimumOperations(self, nums: list[int]) -> int: return sum(num % 3 != 0 for num in nums)