Add Without Plus
Return a + b without using the + or - operators. Use bit operations: the XOR of two numbers is their sum ignoring carries, and the AND shifted left by one is the carries.
Example 1
a 1
b 2
returns 3
3.
Example 2
a 7
b 8
returns 15
15.
Constraints
0 <= a, b <= 1000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.