Timkor

Find the odd int. Bitwise elegant solve

Jul 16th, 2021 (edited)
384
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function findOdd(arr) {
  2.   let result = 0;
  3.   for (let i = 0; i < arr.length; i++) {
  4.     result = result ^ arr[i];
  5.   }
  6.   return result;
  7. }
Add Comment
Please, Sign In to add comment