Contains Duplicate

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

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

- `1 <= nums.length <= 10^5` - `-10^9 <= nums[i] <= 10^9` - The interactive visualizer accepts at most 12 values; longer valid judge inputs are execution-only.

Example 1: input nums = [7, 3, 9, 3]; output true. 3 appears at index 1 and again at index 3.

Example 2: input nums = [5, 8, 2, 4]; output false. All four values in the array are distinct.

Example 3: input nums = [2, 2, 2, 6, 6, 4, 6, 1, 4, 1]; output true. 2 is the first repeated value, occurring twice before the scan moves past index 1.

Category: Arrays & Hashing. Topic: arrays. Difficulty: Easy. Patterns: hashing.