Given an integer array nums, return true if any value appears at least twice, and false if every element is distinct.
nums = [1,2,3,1]truenums = [1,2,3,4]falsetrue (duplicate!)HashSet lookup and insert are both O(1) average. We only need to know if a value was seen before — not its index or count. The moment we encounter a value already in the set, we know there's a duplicate.