LeetCode371. Sum of Two Integers 兩個整數相加,不使用+ -法

先貼上代碼,代碼是別人的,爲了幫助理解,這裏給出解釋,如果有什麼錯誤希望糾正和海涵。 class Solution { public int getSum(int a, int b) { if(b == 0)return a; int carry = (a & b) << 1; int sum = a ^ b; return
相關文章
相關標籤/搜索