Created
November 25, 2017 12:38
-
-
Save Ynote/ff091364077d256fc7c452b3fc361f91 to your computer and use it in GitHub Desktop.
[JavaScript] - Find the integer in the array which occurences number is odd
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
// cf. https://en.wikipedia.org/wiki/Bitwise_operation#XOR | |
const findOdd = arr => arr.reduce((acc, val) => acc ^ val) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment