Talentd
FleetCode

371. Sum of Two Integers

Medium55.9% acceptance8 companies

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

Example 1:

Input: a = 1, b = 2
Output: 3

Example 2:

Input: a = 2, b = 3
Output: 5

Constraints:

  • -1000 <= a, b <= 1000
11:48
Still stuck?Read 3 approaches, or watch a walkthrough.
Open solution

Similar problems

Add Two NumbersMedium
Loading editor…
1class Solution:
2 def getSum(self, a: int, b: int) -> int:
3
Starter codePython 3Spaces: 4
Examples
Input
1
2
Input
2
3
Your code is saved on this device.Solution