程式語言 - LeetCode - CPP - 371. Sum of Two Integers



參考資訊:
https://www.cnblogs.com/grandyang/p/5631814.html

題目:


解答:

class Solution {
public:
    int getSum(int a, int b) {
        while (b != 0) {
            unsigned c = (unsigned)((a & b) << 1);
            a = a ^ b;
            b = c;
        }
        return a;
    }
};