问题:
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
Example:
Given a = 1 and b = 2, return 3.
class Solution(object):
def getSum(self, a, b):
"""
:type a: int
:type b: int
:rtype: int
"""
if( == b):
return a
sum1 = a^b
carry = (a&b)<<
return Solution().getSum(sum1,carry)if __name__ == '__main__':
l = Solution().getSum(,)
print l