Saturday, March 4, 2023

Given a **non-empty** array of integers `nums`

, every element appears *twice* except for one. Find that single one.

- Time complexity: $O(n)$ -
`n`

is a length of a number array - Auxiliary space: $O(1)$ - constant amount of space

```
func singleNumber(nums []int) int {
singleNumber := 0
for _, n := range nums {
singleNumber ^= n
}
return singleNumber
}
```