AlgoUniversity
  • Go Back
Discussion
Duplicate Number :

Author

Ujjwal Srivastava

Difficulty Level : Easy

Submissions : 499

Asked In : Oracle

Marks :10

: 3 | : 0

Given an array of integers $$$nums$$$ containing $$$n$$$ + $$$1$$$ integers where each integer is in the range $$$[1, n]$$$ inclusive.

There is only one repeated number that occurs twice in $$$nums$$$, return this repeated number.

Try to solve the problem without modifying the array $$$nums$$$ and using only constant extra space.

Input

The first line contains an integer $$$n$$$. The second line contains $$$n$$$ + $$$1$$$ integers where each integer is in range $$$1$$$ to $$$n$$$.$$$(1 \le n \le 10^5).$$$

Output

Output a single integer that is repeated.

Examples

Input
3
1 2 3 3
Output
3
Input
4
1 2 1 4 3
Output
1
Input
7
1 2 3 4 5 6 7 4
Output
4

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.