Last updated 3 years ago
Was this helpful?
Not working with negative values.
TODO: Check how to deal with negative binary operations in Python
class Solution: def getSum(self, a: int, b: int) -> int: while b != 0: carry = a&b a = a^b b = carry<<1 print(b) return a