@@ -0,0 +1,1159 @@
+// Given two binary strings, return their sum (also a binary string).%0A%0A// For example,%0A// a = %2211%22%0A// b = %221%22%0A// Return %22100%22.%0A%0Apublic class Solution %7B%0A    public String addBinary(String a, String b) %7B%0A    %09StringBuilder sb = new StringBuilder();%0A    %09int aLen = a.length();%0A    %09int bLen = b.length();%0A    %09if(aLen == 0) return b;%0A    %09if(bLen == 0) return a;%0A%0A    %09int aPointer = aLen - 1;%0A    %09int bPointer = bLen - 1;%0A    %09int carry = 0;%0A%0A    %09while(aPointer %3E= 0 %7C%7C bPointer %3E= 0)%7B%0A    %09%09if(bPointer %3C 0)%7B%0A    %09%09%09int aBit = a.charAt(aPointer--) - '0';%0A    %09%09%09int sum = (aBit + carry) %25 2;%0A    %09%09%09carry = (aBit + carry) / 2;%0A    %09%09%09sb.append(sum);%0A    %09%09%7Delse if(aPointer %3C 0)%7B%0A    %09%09%09int bBit = b.charAt(bPointer--) - '0';%0A    %09%09%09int sum = (bBit + carry) %25 2;%0A    %09%09%09carry = (bBit + carry) / 2;%0A    %09%09%09sb.append(sum);%0A    %09%09%7Delse%7B%0A    %09%09%09int aBit = a.charAt(aPointer--) - '0';%0A    %09%09%09int bBit = b.charAt(bPointer--) - '0';%0A    %09%09%09int sum = (aBit + bBit + carry) %25 2;%0A    %09%09%09carry = (aBit + bBit + carry) / 2;%0A    %09%09%09sb.append(sum);%0A    %09%09%7D%0A    %09%7D%0A%0A    %09if(carry != 0)%7B%0A    %09%09sb.append(carry);%0A    %09%7D%0A%0A    %09sb.reverse();%0A    %09return sb.toString();%0A    %7D%0A%7D

add add binary solution