Skip to content

Instantly share code, notes, and snippets.

@adyngom
Created September 7, 2017 18:46
Show Gist options
  • Save adyngom/60f4f2d2037f55fab84213c67597ee78 to your computer and use it in GitHub Desktop.
Save adyngom/60f4f2d2037f55fab84213c67597ee78 to your computer and use it in GitHub Desktop.
function solution(A) {
return A.reduce( (a,c) => a ^= c ); // xor operator is sexy :)
}
var barr = [10,10, 4, 3, 4, 6, 8, 8, 6];
console.log(solution(barr)); // returns 3;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment