Given an array of integers, every element appears three times except for one. Find that single one.

Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?

1.

one = (0000 ^ 0010) & ~0000
= 1101 & 1111
= 1101

two = (0000 ^ 0010) & ~1101
= 1101 & 0010
= 0000

2.

one = (1101 ^ 0010) & ~0000
= 0000 & 1111
= 0000

two = (0000 ^ 0010) & ~0000
= 1101 & 1111
= 1101

3.

one = (0000 ^ 0010) & ~ 1101
= 1101 & 0010
= 0000

two = (1101 ^ 0010) & ~0000
= 0000 & 1111
= 0000