Search
⌘K

Leetcode 1342. Number of Steps to Reduce a Number to Zero

Count how many operations it takes to reduce a nonnegative integer to zero if you must divide by 2 when it's even and subtract 1 when it's odd. This can be done by simple simulation or more efficiently with bitwise reasoning (constraints: 0 ≤ num ≤ 10^6).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.