Bit ManipulationArray
In an array every value appears exactly three times, except for one value that appears once. Find that single value using linear time and constant extra space.
Input
Line 1: n (always of the form 3k + 1). Line 2: n integers.
Output
Print the value that appears once.
Constraints
1 <= n <= 3 * 10^4 -2^31 <= each value <= 2^31 - 1
Example 1
Input
4 2 2 3 2
Output
3
2 appears three times; 3 appears once.