## Remove the duplicate elements from the array.

## Solution

An array may contain a combination of number, some of which may be repeated.

In order to keep the order of elements same, sorting should not be required.

To find the duplicate element, best data structure is hash map. Using hash, we can keep track of numbers present in array and easily check if any elements is repeated.

### Implementation

```
function findUniques(numbers) {
let hash = {};
let result = [];
for (let i = 0; i < numbers.length; i++) {
//skip if already in hash
if (!hash.hasOwnProperty(numbers[i])) {
// set it to 1 because 0 is falsey
hash[numbers[i]] = 1;
result.push(numbers[i]);
}
}
return result;
}
//Input: findUniques([13, 7, 61, 8, 5, 11, 7, 19, 8, 76])
//Output: [13, 7, 61, 8, 5, 11, 19, 76]
```

```
def findUniques(arr):
hash = {}
result = []
for current in arr:
if current not in hash.keys():
hash[current] = 1
result.append(current)
return result
# Input: print(findUniques([13, 7, 61, 8, 5, 11, 7, 19, 8, 76]))
#Output: [13, 7, 61, 8, 5, 11, 19, 76]
```

```
// third
```

```
fourth
```