Skip to content

Commit 90121c3

Browse files
Sean PrashadSean Prashad
authored andcommitted
Add 371_Sum_of_Two_Integers.java
1 parent 63e4bc1 commit 90121c3

File tree

1 file changed

+11
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)