Question

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.

This is anarrays question.

Idea
Use a hashmap to store “seen” values which you can index into in O(1) time, iterate through the nums list checking if each number seen is in the hashmap.

Solution