human
Can you provide a code to count number of steps to cover a distance if steps can be taken in powers of 2 and the other steps required given the following:
Count number of steps to cover a distance if steps can be taken in powers of 2 | Function to count the minimum number of steps.
bin ( K ) . count ( "1" ) is a Python3 function to count the number of set bits in a number.
Driver Code"
Solution in Python:
assistant
#Here is code to count number of steps to cover a distance if steps can be taken in powers of 2 and the other steps required.
 def getMinSteps ( K ) :
	return bin ( K ) . count ( "1" )
n = 343
print ( getMinSteps ( n ) )