Diwali Offer!Flat 20% OFF
Enroll Now
PrakalpanaLive online tech training

3. Contains Duplicate

EasyDay 1 of 60Arrays & Hashing

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

Example 1
Input: nums = [1,2,3,1]
Output: true
The value 1 appears at index 0 and index 3.
Example 2
Input: nums = [1,2,3,4]
Output: false
Constraints
  • 1 <= nums.length <= 10^5
  • -10^9 <= nums[i] <= 10^9
Hints
Frequently asked at: Amazon, Apple, Adobe, Zoho, Cognizant
Ctrl + Enter runs the examples

Not sure what to learn next?

A 1-on-1 session with an industry mentor and a roadmap built for you. How it works

  1. 1Discuss your goals
  2. 2Get a personal plan
  3. 3Start learning
Book for β‚Ή200/ 30 min