1611. Minimum One Bit Operations to Make Integers Zero

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1611

class Solution:
    def minimumOneBitOperations(self, n: int) -> int:
        if n == 0:
            return 0
        return n ^ self.minimumOneBitOperations(n >> 1)