Skip to content

Commit

Permalink
Add csharp solution for 371 Sum of two integers
Browse files Browse the repository at this point in the history
  • Loading branch information
SPponmag committed Aug 20, 2022
1 parent f110883 commit cb5f7c4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions csharp/371-Sum-Of-Two-Integers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Solution {
public int GetSum(int a, int b) {
while (b != 0)
{
var carry = a & b;
a = a ^ b;
b = carry << 1;
}
return a;
}
}

0 comments on commit cb5f7c4

Please sign in to comment.