Easy · Arrays & hashing
Contains Duplicate
You are given a list of whole numbers, nums. Return true if any value appears at least twice, and false if every value is different.
- An empty list has no duplicates, so it gives false.
- The list is not sorted, and the numbers can be negative.
nums = [1, 2, 3, 1] → true (1 appears twice)Record your take