描述
给出两个整数 a 和 b , 求它们的和。
解决代码
public class Solution {
/**
* @param a: An integer
* @param b: An integer
* @return: The sum of a and b
*/
public int aplusb(int a, int b) {
// write your code here
while(true){
if(a == 0) return b;
if(b == 0) return a;
int _xor = a ^ b;
int _and = (a & b) << 1;
a = _xor;
b = _and;
}
}
}