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.
This commit is contained in:
		
							parent
							
								
									c389b46ecf
								
							
						
					
					
						commit
						4732a7456b
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -22,7 +22,7 @@ | ||||||
| ** DONE Container With Most Water | ** DONE Container With Most Water | ||||||
|    https://leetcode.com/problems/container-with-most-water/ |    https://leetcode.com/problems/container-with-most-water/ | ||||||
| * Binary | * Binary | ||||||
| ** TODO Sum of Two Integers | ** DONE Sum of Two Integers | ||||||
|    https://leetcode.com/problems/sum-of-two-integers/ |    https://leetcode.com/problems/sum-of-two-integers/ | ||||||
| ** DONE Number of 1 Bits | ** DONE Number of 1 Bits | ||||||
|    https://leetcode.com/problems/number-of-1-bits/ |    https://leetcode.com/problems/number-of-1-bits/ | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue