#14

Contains Duplicate

Easy
All Problems

14. Contains Duplicate#217

Easy📊 Arrays & HashingHash Set

Return true if any value appears at least twice in the array.

Examples

Example 1:
Input: [[1,2,3,1]]
Output: true
Example 2:
Input: [[1,2,3,4]]
Output: false
Example 3:
Input: [[1,1,1,3,3,4,3,2,4,2]]
Output: true

Why learn this

The simplest hash set problem — just check for repeats. First step into set-based thinking.

ArraysHash Sets
Python 3Loading Python engine...
Click "Run Code" to test your solution