Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit df76ed3

Browse files
authored
Create 371-Sum-of-Two-Integers.java
1 parent dc67c5e commit df76ed3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

java/371-Sum-of-Two-Integers.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution {
2+
public int getSum(int a, int b) {
3+
while (b != 0) {
4+
int tmp = (a & b) << 1;
5+
a = (a ^ b);
6+
b = tmp;
7+
}
8+
return a;
9+
}
10+
}

0 commit comments

Comments
 (0)