Find the Duplicate

Medium · rating 1400 · Arrays, Hashing

The first line has n. The second line has n+1 integers, each in 1..n, with exactly one value repeated. Print the repeated value.

Constraints: 1 ≤ n ≤ 105

Related problems

Open Find the Duplicate in Code Arena →