human
Minimum number of decrements by 1 required to reduce all elements of a circular array to 0 | Function to find minimum operation require to make all elements 0.
Stores the maximum element and its position in the array.
Traverse the array.
Update the maximum element and its index.
Print the minimum number of operations required.
Driver Code"
Solution in Python:
 ... Give me a code to minimum number of decrements by 1 required to reduce all elements of a circular array to 0 and the other steps required?
assistant
#Here is code to minimum number of decrements by 1 required to reduce all elements of a circular array to 0 and the other steps required.
 def minimumOperations ( arr , N ) :
	mx = 0
	pos = 0
	for i in range ( N ) :
		if ( arr [ i ] >= mx ) :
			mx = arr [ i ]
			pos = i
	print ( ( mx - 1 ) * N + pos + 1 )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 2 , 0 , 2 ]
	N = len ( arr )
	minimumOperations ( arr , N )