Contains Duplicate

Easy
arrays Apple Amazon Bloomberg

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

Example

contains_duplicate([1, 2, 3, 1])  # => True
contains_duplicate([1, 2, 3, 4])  # => False

Test Cases

Python Editor

Output

Click "Run" to see results...