human
Minimum index i such that all the elements from index i to given index are equal | Function to return the minimum required index.
Start from arr [ pos - 1 ].
All elements are equal from arr [ i + 1 ] to arr [ pos ].
Driver code.
Function Call"
Solution in Python:
 ... Give me a code to minimum index i such that all the elements from index i to given index are equal and the other steps required?
assistant
#Here is code to minimum index i such that all the elements from index i to given index are equal and the other steps required.
 def minIndex ( arr , n , pos ) :
	num = arr [ pos ]
	i = pos - 1
	while ( i >= 0 ) :
		if ( arr [ i ] != num ) :
			break
		i -= 1
	return i + 1
arr = [ 2 , 1 , 1 , 1 , 5 , 2 ]
n = len ( arr )
pos = 4
print ( minIndex ( arr , n , pos ) )