We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c8ec385 commit 1db6b90Copy full SHA for 1db6b90
1 file changed
sum-of-two-integers/chjung99.go
@@ -0,0 +1,12 @@
1
+func getSum(a int, b int) int {
2
+ for b != 0 {
3
+ sumWithoutCarry := a ^ b
4
+ carry := (a & b) << 1
5
+
6
+ a = sumWithoutCarry
7
+ b = carry
8
+ }
9
+ return a
10
+}
11
12
0 commit comments