diff options
author | William Carroll <wpcarro@gmail.com> | 2020-12-25T03·50+0000 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2020-12-25T03·50+0000 |
commit | 4732a7456b91840c8a765af3ae7dbe4aea41d2a4 (patch) | |
tree | 62d80e04c9fa247ebe32f937b64e19ac4b277f9c /scratch/facebook | |
parent | c389b46ecfde16f0f197ca8946b336dbf946453c (diff) |
Solve Binary "Sum of Two Integers"
This is tricky because Python has variable-width integers, so relying on two's complement to support the sum of negative numbers results in infinite recursion. I know three ways to combat this: 1. Use Java. 2. Conditionally branch and handle either addition or subtraction accordingly. 3. Use a mask to enforce fixed-width integers in Python.
Diffstat (limited to 'scratch/facebook')
-rw-r--r-- | scratch/facebook/leetcode.org | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scratch/facebook/leetcode.org b/scratch/facebook/leetcode.org index 0328d0b7647e..ebbacd69dec4 100644 --- a/scratch/facebook/leetcode.org +++ b/scratch/facebook/leetcode.org @@ -22,7 +22,7 @@ ** DONE Container With Most Water https://leetcode.com/problems/container-with-most-water/ * Binary -** TODO Sum of Two Integers +** DONE Sum of Two Integers https://leetcode.com/problems/sum-of-two-integers/ ** DONE Number of 1 Bits https://leetcode.com/problems/number-of-1-bits/ |