2023-08-21 23:11:08 +02:00
|
|
|
# single-number
|
|
|
|
|
|
|
|
Created by [@theoludwig](https://github.com/theoludwig) on 21 August 2023.
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
|
|
|
Given a **non-empty** array of integers, every element appears twice except for one. Find that single one.
|
|
|
|
|
|
|
|
You must implement a solution with a linear runtime complexity and use only constant extra space.
|
|
|
|
|
|
|
|
### Constraints
|
|
|
|
|
2023-08-27 15:09:31 +02:00
|
|
|
- $$1 \leq numbers.length \leq 3 \times 10^4$$
|
|
|
|
- $$-3 \times 10^4 \leq numbers[index] \leq 3 \times 10^4$$
|
2023-08-21 23:11:08 +02:00
|
|
|
- Each element in the array appears twice except for one element which appears only once.
|
|
|
|
|
|
|
|
## Source
|
|
|
|
|
|
|
|
[LeetCode - Single Number](https://leetcode.com/problems/single-number/)
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
See the `test` folder for examples of input/output.
|
|
|
|
|
|
|
|
### Example 1
|
|
|
|
|
|
|
|
#### Input
|
|
|
|
|
|
|
|
```txt
|
|
|
|
4
|
|
|
|
1
|
|
|
|
2
|
|
|
|
1
|
|
|
|
2
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Output
|
|
|
|
|
|
|
|
```txt
|
|
|
|
4
|
|
|
|
```
|