1611. Minimum One Bit Operations to Make Integers Zero

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 1611

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