15: Unique number
Given an array of integers
, every element appears twice
except one. Find that unique element
Example 1
Input: [3, 1, 3]
Output: 1
Example 2
Input: [5, 7, 0, 5, 0]
Output: 7
Note: Return
-1
if array is empty
Given an array of integers
, every element appears twice
except one. Find that unique element
Example 1
Input: [3, 1, 3]
Output: 1
Example 2
Input: [5, 7, 0, 5, 0]
Output: 7
Note: Return
-1
if array is empty