3192.cpp (239B)
1 class Solution { 2 public: 3 int minOperations(const vector<int> &nums) const { 4 int res = 0; 5 6 for (const int n : nums) { 7 if ((n + res) % 2) continue; 8 res++; 9 } 10 11 return res; 12 } 13 };