Add two integers without using the standard arithmetic operators.
Given two integers a and b, return their sum without using the + or - operators.
You may use bitwise operators and basic control flow. The goal is to compute the result exactly as normal integer addition would, including handling carries between bit positions.
a and b.a + b.+ or - operators in the core computation.Example 1
Input
a = 1, b = 2
Output
3
Explanation
Binary addition of 1 and 2 gives 3.
Example 2
Input
a = 5, b = -3
Output
2
Explanation
The method should still work when one number is negative.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.