leetcode/en/lcci/17.1/ #4013
Replies: 1 comment
-
class Solution {
}; Why use XOR and AND operations for addition? Intuition behind XOR: a = 14 (which is 1110 in binary). a = 14 (1110), b = 4 (0100). Second step (XOR and AND again): Now a = 10 (1010) and b = 8 (1000). Third step (XOR and AND again): Now a = 2 (0010) and b = 16 (10000). Final Result: Why continue until no carry? |
Beta Was this translation helpful? Give feedback.
-
leetcode/en/lcci/17.1/
LeetCode solutions in any programming language
https://doocs.github.io/leetcode/en/lcci/17.1/
Beta Was this translation helpful? Give feedback.
All reactions