public class Solution {
public int singleNumber(int[] A) {
int[] tem = new int[32];
for (int a : A) {
int x = 1;
for (int t = 0; t < 32; t++) {
if (((x << t) & a) != 0) {
tem[t]++;
}
}
}
int result = 0;
for (int t = 0; t < 32; t++) {
if (tem[t] % 3 != 0) {
result = result | (1 << t);
}
}
return result;
}
}
public int singleNumber(int[] A) {
int[] tem = new int[32];
for (int a : A) {
int x = 1;
for (int t = 0; t < 32; t++) {
if (((x << t) & a) != 0) {
tem[t]++;
}
}
}
int result = 0;
for (int t = 0; t < 32; t++) {
if (tem[t] % 3 != 0) {
result = result | (1 << t);
}
}
return result;
}
}