FreeCareerPath
Build the PrimitiveMedium

Sum of Two Integers

Write `get_sum(a, b)` returning `a + b` without using `+` or `-`. Inputs may be negative and fit in 32 bits. XOR gives the addition with every carry dropped; `(a & b) << 1` gives exactly those carries. Repeat until no carry remains. In Python there is a twist worth knowing: integers are arbitrary precision, so negatives never stop carrying — mask to 32 bits each round and convert back at the end.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Sum of Two Integers" are saved to your account — logging in takes a few seconds.

Sum of Two Integers — FreeCareerPath