Skip to content

Commit cb5f7c4

Browse files
committed
Add csharp solution for 371 Sum of two integers
1 parent f110883 commit cb5f7c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

csharp/371-Sum-Of-Two-Integers.cs

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

0 commit comments

Comments
 (0)