Sum of Two Integers

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

Example 1
Inputa = 1, b = 2
Output3
The sum of 1 and 2 is 3.
Example 2
Inputa = 2, b = 3
Output5
The sum of 2 and 3 is 5.

Constraints

  • -1000 <= a, b <= 1000

Asked at 8 companies

Practice questions like this out loud in a mock coding interview with a live AI interviewer. First one free.

Your Solution

(Ctrl/Cmd + Enter)

Switching Language

Loading template...

Sign in to save your progress

AI code evaluation

Get a correctness verdict, what to keep, what's wrong, and the complexity of your solution.

Sign in to evaluate