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)


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