Skip to content

Latest commit

 

History

History

First repeating element

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

First repeating element

Given an array of integers, find the first repeating element in it. We need to find the element that occurs more than once and whose index of first occurrence is smallest.

Input Format
You will be given a function with an integer array as arguments.

Constraints
1 < N < 10^5
1 < a[i] < 10^5

Output Format
You need to return the first repeating element from the function.

Sample Input

7
10
5
3
4
3
5
6

Sample Output
5