Minimum One Bit Operations to Make Integers Zero (LeetCode 1611)
Asked in the Online Assessment stage. This was the second coding question in the Online Assessment.
Given a non-negative integer n, return the minimum number of operations needed to make it zero. In one operation, flip bit 0, or flip bit i > 0 only when bit i - 1 is 1 and all lower bits are 0.
Implement minimum_one_bit_operations(n), accepting an integer and returning an integer.
def minimum_one_bit_operations(n):