Duplicate Check in an Array

JavaScript Easy sets

Task «Duplicate Check in an Array»

Write a function that takes an array of numbers and determines whether it contains duplicates. If the array has at least two identical numbers, return true, otherwise false. Use a Set to solve the problem.

Input Format

The first line contains an integer n (1 ≤ n ≤ 1000) — the number of elements. The second line contains n integers separated by spaces, each from -10^6 to 10^6.

Output Format

Output 'true' (without quotes) if there are duplicates, and 'false' otherwise.

main.js