Leetcode 1054 Solution
This article provides solution to leetcode question 1054 (complement-of-base-10-integer)
Access this page by simply typing in "lcs 1054" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/complement-of-base-10-integer
Solution
class Solution:
def bitwiseComplement(self, N: int) -> int:
if N == 0:
return 1
m = 1
while m <= N:
m *= 2
return m - N - 1