Sum of Two Integers
MediumBit Manipulation & Math
Decode it first. Clues, constraints, pattern and plan before any code.Return the sum of the integers a and b without using the operators + or - (and without helpers like sum). Work with the bits directly.
a = 1, b = 2 → 3
a = 2, b = 3 → 5
a = -5, b = -7 → -12Constraints
-1000 <= a, b <= 1000- Treat the numbers as signed 32-bit integers.