Skip to content

Instantly share code, notes, and snippets.

@platypusrex
Created April 8, 2018 17:08
Show Gist options
  • Save platypusrex/0e4b23821a44f4f7d851dd79742dd195 to your computer and use it in GitHub Desktop.
Save platypusrex/0e4b23821a44f4f7d851dd79742dd195 to your computer and use it in GitHub Desktop.
Given an array, find the int that appears an odd number of times.
const findOdd = (arr) => arr.reduce((a,b) => a ^ b);
findOdd([1,1,2,-2,5,2,4,4,-1,-2,5])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment