leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

2997.cpp (312B)


0 static auto _ = []() {
1 ios_base::sync_with_stdio(false);
2 cout.tie(NULL);
3 cin.tie(NULL);
4 return NULL;
5 }();
7 class Solution {
8 public:
9 int minOperations(const vector<int> &nums, int k) const {
10 for (const int n : nums)
11 k ^= n;
12 return __builtin_popcount(k);
13 }
14 };