Contains Duplicate

Easy · Arrays & Hashing · Array · Hash Table · Sorting

Problem

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

Examples

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

1 appears twice.

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

Constraints

Approaches

Related problems

Start free on Cariara · Coding problems · System design studio

Starting Python
No results yet.

          
↑↓ move ↵ open esc close

Labs

Loading labs…

Run with your own input

Starting Python

Loading Python…