A simple 3-line solution with bit manipulation and recursion
Explanation\n\nImagine we are doing addition in binary. We can break it into 3 parts:\n\n calculate every bit correspondingly and find what remains\n if it exce
# Explanation\n\nImagine we are doing addition in binary. We can break it into 3 parts:\n\n* calculate every bit correspondingly and find what remains\n* if it exceeds, bring it to next bit as a carry\n* add remain and carry, which we can do recursively\n\nFor example,\n\n7 + 5 =\n\n0 0 1 1 1\n0 0 1 0 1\n__----------__\n0 0 0 1 0    -----> remain = a xor b\n0 1 0 1 0    -----> carry = (a and b) << 1\n__----------__   -----> another addition\n0 1 0 0 0\n0 0 1 0 0\n__----------__\n0 1 1 0 0\n\nSo answer is pretty trivial, we do first 2 steps and invoke the method again using the results of previous steps as arguments.\n\n# Solution\n\nHere is the code\n```\npublic static int getSum(int a, int b) {\n  if (a == 0) return b;\n  if (b == 0) return a;\n  return getSum(a ^ b, (a & b) << 1);\n}\n```
['Bit Manipulation', 'Recursion', 'Java']