Created
April 14, 2022 16:32
-
-
Save esase/42a2fdade63da7df07e00616883639df to your computer and use it in GitHub Desktop.
Single number [https://leetcode.com/problems/single-number]
This file contains 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
/** | |
* @param {number[]} nums | |
* @return {number} | |
*/ | |
var singleNumber = function(nums) { | |
let result = 0; | |
for (let value of nums) { | |
result ^= value; | |
} | |
return result; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment