XOR-ing the Subarrays! Time : Space : 123456789int Solution::solve(vector<int> &A) { int res = 0, n = A.size(); for(int i = 0; i < n; i++) { int req = (i + 1) * (n - i); if(req & 1) res ^= A[i]; } return res;}