Finding repeated elements in array of integers
Suppose you're given an array of integers. Write code to find the first repeating element in the array.
Input: array = [10, 2, -2, -20, 10] Output: 10 Input: array = [9, 4, 20, 20, 10, 5] Output: 20
If there are no duplicates, you can return -1.
Subscribe to premium account to see the solution.Get premium now