题目链接:
https://leetcode.cn/problems/bu-yong-jia-jian-cheng-chu-zuo-jia-fa-lcof/description/?favorite=xb9nqhhg
代码:
class Solution {
public:
int add(int a, int b) {
while(b)
{
unsigned int carry=(unsigned int)(a&b)<<1;
a=a^b;
b=carry;
}
return a;
}
};