Sum of Two Integers
Sum of Two Integers
Given two integers a and b, return the sum of the two integers without using the operators + and -.
Examples
Example 1:
Input: a = 1, b = 2
Output: 3Example 2:
Input: a = 2, b = 3
Output: 5Example 3:
Input: a = -1, b = 1
Output: 0Constraints
-1000 <= a, b <= 1000
Expected Complexity
- Time: O(1). at most 32 iterations for 32-bit integers
- Space: O(1)
MEDIUM
Bit Manipulation
Mathematics
Algorithms
Intermediate
0 views
Solution
Hints
Hint 1
Hint 2
Premium
Hint 3
Premium
Hint 4
Premium
This section is available for CodeSnatch Premium members only.
