Sum of Two Integers

https://leetcode.com/problems/sum-of-two-integers

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

Last updated