Minimum Operations to Reduce an Integer to 0
Halve while the number is even; on an odd number, add one when its low two bits are 11 so a long run of ones collapses, and subtract one otherwise.
Halve while the number is even; on an odd number, add one when its low two bits are 11 so a long run of ones collapses, and subtract one otherwise.