human
Steps required to visit M points in order on a circular ring of N points | Function to count the steps required.
Start at 1.
Initialize steps.
If nxt is greater than cur.
Now we are at a [ i ].
Driver code"
Solution in Python:
 ... Give me a code to steps required to visit M points in order on a circular ring of N points and the other steps required?
assistant
#Here is code to steps required to visit M points in order on a circular ring of N points and the other steps required.
 def findSteps ( n , m , a ) :
	cur = 1
	steps = 0
	for i in range ( 0 , m ) :
		if ( a [ i ] >= cur ) :
			steps += ( a [ i ] - cur )
		else :
			steps += ( n - cur + a [ i ] )
		cur = a [ i ]
	return steps
n = 3
m = 3
a = [ 2 , 1 , 2 ]
print ( findSteps ( n , m , a ) )