算法1
(暴力枚举) $O(n^2)$
blablabla
时间复杂度分析:blablabla
python 代码
class Solution(object):
def add(self, num1, num2):
"""
:type num1: int
:type num2: int
:rtype: int
"""
n1 = (num1 ^ num2) & 0xFFFFFFFF
n2 = ((num1 & num2) << 1) & 0xFFFFFFFF
n3 = n1 ^ n2
if n2 == 0:
return n3 if n3 <= 0x7fffffff else ~(n3^0xFFFFFFFF)
else:
return self.add(n1,n2)