human
Give me a code to minimum steps to reach the Nth stair in jumps of perfect power of 2 and the other steps required given the following:
Minimum steps to reach the Nth stair in jumps of perfect power of 2 | Function to count the number of jumps required to reach Nth stairs ..
Till N becomes 0.
Removes the set bits from the right to left.
Driver Code.
Number of stairs.
Function Call"
Solution in Python:
assistant
#Here is code to minimum steps to reach the Nth stair in jumps of perfect power of 2 and the other steps required.
 def stepRequired ( N ) :
	cnt = 0 ;
	while ( N > 0 ) :
		N = N & ( N - 1 ) ;
		cnt += 1 ;
	return cnt ;
if __name__ == ' _ _ main _ _ ' :
	N = 23 ;
	print ( stepRequired ( N ) ) ;