0/100 в джъджал Моля за помощ! къде ми е грешката? Bitwise Operations 05. Odd Times
JS - Pastebin.com
* Odd Times
You are given an array of positive integers in a single line, separated by a space (' '). All numbers occur even number of times except one number which occurs odd number of times. Find it, using only bitwise operations.
Examples
Input Output
1 2 3 2 3 1 3 3
5 7 2 7 5 2 5 5
Hints
Read an array of integers.
Initialize a variable result with value 0.
Iterate through all number in the array.
Use XOR (^) of result and all numbers in the array.
XOR of two elements is 0 if both elements are same and XOR of a number x with 0 is x
Print the result.
Think why the above algorithms is correct.