1611. Minimum One Bit Operations to Make Integers Zero
https://leetcode.com/problems/minimum-one-bit-operations-to-make-integers-zero
Description
Given an integer n
, you must transform it into 0
using the following operations any number of times:
Change the rightmost (
0th
) bit in the binary representation ofn
.Change the
ith
bit in the binary representation ofn
if the(i-1)th
bit is set to1
and the(i-2)th
through0th
bits are set to0
.
Return the minimum number of operations to transform n
into 0
.
Example 1:
Example 2:
Example 3:
Example 4:
Example 5:
Constraints:
0 <= n <= 109
ac
Previous1610. Maximum Number of Visible PointsNext1612. Check If Two Expression Trees are Equivalent
Last updated