| leetcodeSolution to some Leetcode problems written in C++ | 
| git clone git://git.dimitrijedobrota.com/leetcode.git | 
| Log | Files | Refs | README | LICENSE | 
2588.cpp (376B)
    0 class Solution {
              1   public:
              2     long long beautifulSubarrays(const vector<int> &nums) const {
              3         static int count[1048577];
              4         long long res = 0;
              5         int crnt = 0;
          
              7         memset(count, 0x00, sizeof(count));
              8         count[0] = 1;
              9         for (const int n : nums) {
             10             crnt ^= n;
             11             res += count[crnt]++;
             12         }
          
             14         return res;
             15     }
             16 };