public class Solution {
public int aplusb(int a, int b) {
// write your code here
// a^b;//10^11=01没有进位
// a&b //10&11=10 说明第2个数有进位,但是进位在高位(第3位)
// <<1 //左移动一位 就是100
// 最后把结果再进^操作给a,直到没有进位
if (b == 0)//有1代表还有进位
return a;
else
return aplusb(a^b, (a&b) << 1);
}
};