Tap here to switch tabs
Problem
Submissions

Problem: N-Repeated Element in Size 2N Array

N-Repeated Element in Size 2N Array gives you an array with one value appearing exactly half its length, while every other value appears once. Return that repeated value.

Statement

You are given an integer array nums of length 2×n2 \times n. The array contains exactly n+1n + 1 unique values. Of these unique values, nn of them appear exactly once, and the remaining one appears exactly nn times.

Return the element that is repeated nn times.

Constraints:

  • 2≤2 \leq n ≤5000\leq 5000

  • nums.length ==2×== 2 \times n

  • 0≤0 \leq nums[i] ≤104\leq 10^4

  • nums contains n+1n + 1 unique elements, and exactly one of them is repeated nn times

⋮
Tap here to switch tabs
Problem
Submissions

Problem: N-Repeated Element in Size 2N Array

N-Repeated Element in Size 2N Array gives you an array with one value appearing exactly half its length, while every other value appears once. Return that repeated value.

Statement

You are given an integer array nums of length 2×n2 \times n. The array contains exactly n+1n + 1 unique values. Of these unique values, nn of them appear exactly once, and the remaining one appears exactly nn times.

Return the element that is repeated nn times.

Constraints:

  • 2≤2 \leq n ≤5000\leq 5000

  • nums.length ==2×== 2 \times n

  • 0≤0 \leq nums[i] ≤104\leq 10^4

  • nums contains n+1n + 1 unique elements, and exactly one of them is repeated nn times