public class Solution { public int GetSum(int a, int b) { return b == 0 ? a : GetSum(a ^ b, (a & b) << 1); } }
https://leetcode.com/problems/sum-of-two-integers/#/description
补充一个python的实现:
1 class Solution: 2 def getSum(self, a: int, b: int) -> int: 3 l = [a,b] 4 result = sum(l) 5 return result