class Solution {
public:
/**
* @param a: An integer
* @param b: An integer
* @return: The sum of a and b
*/
int aplusb(int a, int b) {
// write your code here
if(b==0){
return a;
}
return aplusb(a^b,(a&b)<<1);
}
};
LintCode 之A+B问题(1)
最新推荐文章于 2020-06-29 15:07:29 发布