思路:这样需要用到位运算,是比较基础的算法题,mark一下。
public int twoDataAddSmart(int a, int b) {
int temp, d;
while ((a & b) != 0) {
temp = a ^ b;
d = (a & b) << 1;// 需要进位的地方;
a = temp;
b = d;
}
return a | b;
}