1342. Number of Steps to Reduce a Number to Zero
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/
Python
class Solution:
def numberOfSteps(self, num: int) -> int:
steps = 0
while num:
steps += 1
if num % 2 == 0:
num >>= 1
else:
num -= 1
return steps