Sum of Two Integers
MediumP3Coding
Return the sum of two integers a and b without using the operators + and -.
Example 1
- Input
- a = 1, b = 2
- Output
- 3
Example 2
- Input
- a = 2, b = 3
- Output
- 5
Example 3
- Input
- a = -1, b = 1
- Output
- 0
Constraints
- -1000 <= a, b <= 1000
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.