Sum of Two Integers Problem

Sum of Two Integers Problem — ExecCode Easy DSA Practice

Solve the Sum of Two Integers problem on ExecCode. Free online easy DSA practice in Bit Manipulation. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given two integers a and b, return the sum of the two integers without using the operators + and -, relying instead on XOR for addition and AND-shift for carry propagation.

Examples

Input a = 1, b = 2; Output 3. Input a = 2, b = 3; Output 5. Input a = -2, b = 3; Output 1

Constraints

-1000 <= a, b <= 1000

Practice Sum of Two Integers free on ExecCode. Browse DSA problems, topic map, and placement guides.