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)
最新推荐文章于 2019-10-18 17:01:56 发布