Given an array of integers numbers
, determine whether the array contains any duplicate values. A duplicate is defined as any number that appears more than once in the array.
numbers: number[]
: An array of integersInput: numbers = [5,7,1,3]Output: falseExplanation: All elements in the array are unique.
Input: numbers = [10,7,0,0,9]Output: trueExplanation: 0 appears more than once.
Input: numbers = [3,2,6,5,0,3,10,3,10,5]Output: trueExplanation: 3,5, and 10 appears more than once.
numbers.length
<= 10,000numbers[i]
<= 1,000,000Given an array of integers numbers
, determine whether the array contains any duplicate values. A duplicate is defined as any number that appears more than once in the array.
numbers: number[]
: An array of integersInput: numbers = [5,7,1,3]Output: falseExplanation: All elements in the array are unique.
Input: numbers = [10,7,0,0,9]Output: trueExplanation: 0 appears more than once.
Input: numbers = [3,2,6,5,0,3,10,3,10,5]Output: trueExplanation: 3,5, and 10 appears more than once.
numbers.length
<= 10,000numbers[i]
<= 1,000,000console.log()
statements will appear here.