Last active
May 9, 2021 10:45
-
-
Save ankit167/7838188c6ce2bc77e6ce32d7662795a2 to your computer and use it in GitHub Desktop.
LeetCode 136: https://leetcode.com/problems/single-number/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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