Contains Duplicate Problem
Contains Duplicate Problem — ExecCode Easy DSA Practice
Solve the Contains Duplicate problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.
Problem description
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.
Examples
Input nums = [4, 7, 2, 9, 1, 7, 5]; Output true. Input nums = [1, 2, 3, 4, 5]; Output false. Input nums = [1, 1, 1, 3, 3, 4, 3, 2, 4, 2]; Output true
Constraints
1 ≤ nums.length ≤ 10⁵ -10⁹ ≤ nums[i] ≤ 10⁹
Practice Contains Duplicate free on ExecCode. Browse DSA problems, topic map, and placement guides.