Statement
You are given an integer n
. Your goal is to reduce it to
Flip the rightmost bit (bit at position
) of n
.Flip the bit at position
(for ) only if the bit at position is and all bits from position down to are set to .
Determine and return the minimum number of these operations required to reduce n
to
Constraints:
n