leetcode

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

2425.cpp (313B)


0 class Solution {
1 public:
2 int xorAllNums(const vector<int> &nums1, const vector<int> &nums2) const {
3 int a = 0, b = 0;
4 for (const int n : nums1)
5 a ^= n;
6 for (const int n : nums2)
7 b ^= n;
8 return (nums2.size() % 2 * a) ^ (nums1.size() % 2 * b);
9 }
10 };