Given an unsorted array, arr[] of size N and that contains even number of occurrences for all numbers except two numbers. Find the two numbers in decreasing order which has odd occurrences.
Time : O(n)
Space : O(1)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
classSolution{ public: vector<int> twoOddNum(int Arr[], int N){ int mask = 0; for(int i = 0; i < N; i++) { mask ^= Arr[i]; }