N-Repeated Element in Size 2N Array Problem

N-Repeated Element in Size 2N Array Problem — ExecCode Easy DSA Practice

Solve the N-Repeated Element in Size 2N Array problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given an integer array nums with the following properties:. Your task is to compute the required answer and return the element that is repeated n times. nums.length == 2 n. - nums contains n + 1 unique values, n of which occur exactly once in the array. - Exactly one element of nums is repeated n times.

Examples

Input {"nums": [1, 2, 3, 3]}; Output 3. Input {"nums": [2, 1, 2, 5, 3, 2]}; Output 2

Constraints

2 <= n <= 5000 nums.length == 2 * n 0 <= nums[i] <= 10^4 nums contains n + 1 unique elements and one of them is repeated exactly n times.

Practice N-Repeated Element in Size 2N Array free on ExecCode. Browse DSA problems, topic map, and placement guides.