Simple HashSet implementation to find the duplicate number in the array.

Time Complexity - O(N)

Space Complexity - O(N)

```
public boolean containsDuplicate(int[] nums) {
Set<Integer> set = new HashSet<Integer>();
for(int num : nums){
if(set.contains(num)) return true;
else set.add(num);
}
return false;
}
```