Contains Duplicate
Beginner Mode

Problem Statement

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.

Additional information

  • Assume that the array will have at most 10,000 elements.
  • The elements in the array are integers.
  • The function should handle edge cases such as empty lists and single element lists.

Example 1:

Input: nums = [1, 2, 3, 1]

Output: true

Example 2:

Input: nums = [1, 2, 3, 4]

Output: false
Quick Solution

Code Environment

Sign in or try as guest to run your code.

Sign In

Track

Question Difficulty Company Access
Need more practice in this area? Explore more questions →