44. Single Number
Easy
In an array of integers, every value appears exactly twice except for one that appears only once. Return that value. The array may contain negative numbers.
Example 1
Input: valores = [6, 3, 6, 9, 3]
Output: 9
Explanation: The values 6 and 3 form pairs; 9 appears once.
Example 2
Input: valores = [-4, 12, 12]
Output: -4
Constraints
- 1 <= valores.length <= 10^5
- Cada valor, exceto um, aparece exatamente duas vezes.
- -2^31 <= valores[i] <= 2^31 - 1
ArraysBits
Saved in this browser
Caso 1
valores =
[6,3,6,9,3]
Expected =
9
Caso 2
valores =
[-4,12,12]
Expected =
-4
Run checks these 2 cases. Submit runs all 6, including hidden ones.