• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
May 26, 2022 |14.9K Views
Find the first repeating element in an array of integers
  Share   Like
Description
Discussion

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.

Examples:

Input:  arr[] = {10, 5, 3, 4, 3, 5, 6}
Output: 5 [5 is the first element that repeats]

Input:  arr[] = {6, 10, 5, 4, 9, 120, 4, 6, 10}
Output: 6 [6 is the first element that repeats]

Find the first repeating element in an array of integers : https://www.geeksforgeeks.org/find-first-repeating-element-array-integers/

Read More