Tag

no-plus-minus

1 views collected around this technical thread.

Java Tech Enthusiast
Java Tech Enthusiast
Jan 24, 2025 · Fundamentals

Sum of Two Integers Without Using + or - Operators

The problem asks to add two integers without using '+' or '-', which is solved by repeatedly applying bitwise XOR to obtain the sum without carry and left‑shifted AND to compute the carry until it vanishes, as demonstrated in concise Java and Python implementations with O(1) time and space complexity.

algorithmbitwisejava
0 likes · 4 min read
Sum of Two Integers Without Using + or - Operators