Sum of Two Integers思路:利用易或和与操作
GitHub地址:https://github.com/corpsepiges/leetcode
public class Solution {
public int getSum(int a, int b) {
return b==0?a:getSum(a^b,(a&b)<<1);
}
}
Sum of Two Integers思路:利用易或和与操作
GitHub地址:https://github.com/corpsepiges/leetcode
public class Solution {
public int getSum(int a, int b) {
return b==0?a:getSum(a^b,(a&b)<<1);
}
}