HackerRank 'Lonely Integer' Solution

by Srikant Padala on March 20, 2016, 3:40 am


Explanation


A number Xor'ed with itself gives zero
Lonely Integer Problem Statement

Video

#include <iostream>
using namespace std;
 
int main() {
    int n, f=0,temp;
    cin >> n;
    for(int i=0; i < n; i++) {
        cin >> temp;
        f ^= temp;
    }
    cout << f;
}

Coming Soon.