Dashboard
#75. Sum of Two IntegersMediumBit Manipulation

Given two integers a and b, return the sum of the two integers without using the + and - operators.

Example 1:

Input: a = 1, b = 1

Output: 2

Example 2:

Input: a = 4, b = 7

Output: 11

Constraints:

  • -1000 <= a, b <= 1000
Examples
Example 1:
Input: a = 1, b = 1
Output: 2
Example 2:
Input: a = 4, b = 7
Output: 11
Constraints
  • `-1000 <= a, b <= 1000`
Prerequisites
Target: O(N) time • O(1) spaceMath / Bit Manipulation
Socratic AI Tutor
Gemini 3.8 Flash
Loading editor...

Click "Run" or press Ctrl+Enter to execute test cases.