/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public int singleNumber(int[] nums) {
int sing = nums[0];
for (int i = 1; i < nums.length; i++) {
sing = sing ^ nums[i];
}
return sing;
}
{
// your code goes here
Ideone x = new Ideone();
int[] arr = {4, 5, 5, 2, 2};
System.
out.
println(x.
singleNumber(arr
)); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBpbnQgc2luZ2xlTnVtYmVyKGludFtdIG51bXMpIHsKICAgIGludCBzaW5nID0gbnVtc1swXTsKICAgIGZvciAoaW50IGkgPSAxOyBpIDwgbnVtcy5sZW5ndGg7IGkrKykgewogICAgICBzaW5nID0gc2luZyBeIG51bXNbaV07CiAgICB9CiAgICByZXR1cm4gc2luZzsKCiAgfQogIAoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJCUlkZW9uZSB4ID0gbmV3IElkZW9uZSgpOwoJCWludFtdIGFyciA9IHs0LCA1LCA1LCAyLCAyfTsKCQlTeXN0ZW0ub3V0LnByaW50bG4oeC5zaW5nbGVOdW1iZXIoYXJyKSk7Cgl9Cn0=