Skip to content

Instantly share code, notes, and snippets.

@ankit167
Last active May 9, 2021 10:45
Show Gist options
  • Save ankit167/7838188c6ce2bc77e6ce32d7662795a2 to your computer and use it in GitHub Desktop.
Save ankit167/7838188c6ce2bc77e6ce32d7662795a2 to your computer and use it in GitHub Desktop.
public int singleNumber(int[] nums) {
int xor = 0;
for (int i = 0; i < nums.length; i++) {
xor = xor ^ nums[i];
}
return xor;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment