To solve this problem, you'll have to open it on the computer

Contains Duplicate

Arrays
easy
Score: 20

Given an integer array 'nums’, return 1(true) if any value appears at least twice in the array, and return 0(false) if every element is distinct.

Input Format

First Parameter - Number n

Second Parameter - Array of Integer arr

Output Format

Return the integer(0 or 1)

Example 1:

Input:
    4
    1 2 3 1
Output:
    1
Explanation:
    '1' is repeated two times.

Example 2:

Input:
    4
    1 2 3 4 
Output:
    0
Explanation:
    No values are repeated.

Constraints:

  • 1 <= nums.length <= 105
  • -10^9 <= nums[i] <= 10^9
Submit code to see the your result here