Skip to content

Instantly share code, notes, and snippets.

@Cee
Created May 26, 2014 08:38
Show Gist options
  • Save Cee/e3f57aa887bd8d6c802f to your computer and use it in GitHub Desktop.
Save Cee/e3f57aa887bd8d6c802f to your computer and use it in GitHub Desktop.
public class Solution {
public int singleNumber(int[] A) {
int[] count = new int[32];
int result = 0;
for (int i = 0; i < 32; i++) {
for (int j = 0; j < A.length; j++) {
if (((A[j] >> i) & 1) == 1) {
count[i]++;
}
}
result |= ((count[i] % 3) << i);
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment