1342. Number of Steps to Reduce a Number to Zero
https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero
Description
Given an integer num
, return the number of steps to reduce it to zero.
In one step, if the current number is even, you have to divide it by 2
, otherwise, you have to subtract 1
from it.
Example 1:
Example 2:
Example 3:
Constraints:
0 <= num <= 106
ac
Previous1341. Movie RatingNext1343. Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold
Last updated