@@ -0,0 +1,1055 @@
+/***%0A * Given an array of integers, every element appears three times except for one. Find that single one.%0A *%0A * Note:%0A * Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?%0A */%0Apublic class Solution %7B%0A%0A    // Simulate 3 Hex computation. O(n) O(1)%0A    public int singleNumber(int%5B%5D A) %7B%0A        int W = 32;%0A        int count%5B%5D = new int%5BW%5D;%0A        for (int i = 0; i %3C A.length; i++) %7B%0A            for (int j = 0; j %3C W; j++) %7B%0A                count%5Bj%5D += (A%5Bi%5D %3E%3E j) & 1;%0A                count%5Bj%5D %25= 3;%0A            %7D%0A        %7D%0A%0A        int result = 0;%0A        for (int i = 0; i %3C W; i++)%0A            result += (count%5Bi%5D %3C%3C i);%0A        return result;%0A    %7D%0A%0A    // Solution 2:%0A    public int singleNumber(int%5B%5D A) %7B%0A        int ones = 0, twos = 0, threes = 0;%0A        for (int i = 0; i %3C A.length; i++)%7B%0A            twos %7C= (ones & A%5Bi%5D);%0A            ones %5E= A%5Bi%5D;%0A            threes = ~(ones & twos);%0A            ones &= threes;%0A            twos &= threes;%0A        %7D%0A        return ones;%0A%0A    %7D%0A%0A%7D%0A

add SingleNumberII.java