@@ -0,0 +1,798 @@
+//371. Sum of Two Integers%0A/**%0A * Calculate the sum of two integers a and b, %0A * but you are not allowed to use the operator + and -.%0A * %0A * Example:%0A * Given a = 1 and b = 2, return 3.%0A * %0A * Tags: Bit Manipulation%0A * Similar Problems: (M) Add Two Numbers%0A * %0A * @author Xinyue Zhang%0A *%0A */%0Apublic class Solution %7B%0A    public int getSum(int a, int b) %7B%0A        if (a == 0) return b;%0A        if (b == 0) return a;%0A        %0A        while (b != 0) %7B%0A            int carry = a & b;  //find carry%0A            a = a %5E b;          //xor%0A            b = carry %3C%3C 1;     //left shift carry bit%0A        %7D%0A        %0A        return a;%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A        int a = 7, b = 3;%0A        Solution sol = new Solution();%0A        System.out.println(sol.getSum(a, b));%0A    %7D%0A%7D%0A

Add solution for 371. Sum of Two Integers