Created
August 3, 2017 14:00
-
-
Save luojiyin1987/5e084ff7a25e017cfaba23c92156bb19 to your computer and use it in GitHub Desktop.
Sum of Two Integers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func getSum(a int, b int) int { | |
| for b != 0 { | |
| c := a & b | |
| a ^=b | |
| b = c<<1 | |
| } | |
| return a | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment