easy题,按照逻辑写就行了
class Solution:
def numberOfSteps(self, num: int) -> int:
step = 0
while num:
if num % 2 == 0:
num = num/2
else:
num -= 1
step += 1
return step