Leetcode 371 Solution

This article provides solution to leetcode question 371 (sum-of-two-integers)

https://leetcode.com/problems/sum-of-two-integers

Solution

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