human
Find the first repeating element in an array of integers | This function prints the first repeating element in arr [ ].
This will set k = 1 , if any repeating element found.
max = maximum from ( all elements & n ).
Array a is for storing 1 st time occurence of element initialized by 0.
Store 1 in array b if element is duplicate initialized by 0.
Duplicate element found.
Storing 1 st occurence of arr [ i ].
Trace array a & find repeating element with min index.
Driver code"
Solution in Python:
 ... Give me a code to find the first repeating element in an array of integers and the other steps required?
assistant
#Here is code to find the first repeating element in an array of integers and the other steps required.
 def printFirstRepeating ( arr , n ) :
	k = 0
	max = n
	for i in range ( n ) :
		if ( max < arr [ i ] ) :
			max = arr [ i ]
	a = [ 0 for i in range ( max + 1 ) ]
	b = [ 0 for i in range ( max + 1 ) ]
	for i in range ( n ) :
		if ( a [ arr [ i ] ] ) :
			b [ arr [ i ] ] = 1
			k = 1
			continue
		else :
			a [ arr [ i ] ] = i
	if ( k == 0 ) :
		print ( " No ▁ repeating ▁ element ▁ found " )
	else :
		min = max + 1
		for i in range ( max + 1 ) :
			if ( a [ i ] and ( min > ( a [ i ] ) ) and b [ i ] ) :
				min = a [ i ]
		print ( arr [ min ] )
arr = [ 10 , 5 , 3 , 4 , 3 , 5 , 6 ]
n = len ( arr )
printFirstRepeating ( arr , n )