class Solution(object):
def summation(self
, a
, b
):
"""
:type nums: List[int]
:rtype: int
"""
plain_sum
= a
^ b
carry
= (a
& b
) << 1
while carry
:
temp
= plain_sum
plain_sum
= plain_sum
^ carry
carry
= (temp
& carry
) << 1
return plain_sum
if __name__
== '__main__':
print(Solution
().summation
(-5, 4))
转载请注明原文地址: https://mac.8miu.com/read-488991.html