Skip to main content
LeetCode 371, Medium. Topics: Math, Bit Manipulation. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 15 parametrized pytest cases, and a playground notebook:

Problem

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

Examples

Constraints

-1000 <= a, b <= 1000

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

Blind 75, NeetCode 150, NeetCode 250, NeetCode All.
Last modified on August 25, 2026