Recently, when I played on LeetCode.com, there is a solution for a question is really beautiful. In this post, I want to present this solution.
The question is:
The solution is:
public int singleNumber(int[] A) {
int result = 0;
for (int i : A) result ^= i ;
return result ;
}