Leetcode 136  Single Number
Problem Statement
Given a nonempty array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,1]
Output: 1
Example 2:
Input: [4,1,2,1,2]
Output: 4
Solution


This is an xor problem. If you have a list of number that are unsorted and you want to find the unique number, then xor all the numbers in the list and the final result will be the unique number. For example,
[2, 2, 1] is [010, 010, 001] so tracing through the code above:


or for [4, 1, 2, 1, 2]

