Problem 371 · Medium

Sum of Two Integers

Add two integers without using the plus or minus operators, by combining bitwise XOR for the sum and AND for the carry. The visual shows each carry shifting left until no carries remain.

Open the interactive visualisation