- We can use
`a ^ b`

to get the bits of the sum without considering the carry bits. - We can get carry bits by using
`a & b`

like the operation above. - So it become the sub-problem. We need to calculate the sum of
`(a^b)`

and`(a & b) << 1`

. - When the carry bits if zero, the function will return.

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