@@ -0,0 +1,1191 @@
+/*%0A67. Add Binary%0AEasy%0A%0AGiven two binary strings, return their sum (also a binary string).%0A%0AThe input strings are both non-empty and contains only characters 1 or 0.%0A%0AExample 1:%0A%0AInput: a = %2211%22, b = %221%22%0AOutput: %22100%22%0AExample 2:%0A%0AInput: a = %221010%22, b = %221011%22%0AOutput: %2210101%22%0A %0A%0AConstraints:%0A%0AEach string consists only of '0' or '1' characters.%0A1 %3C= a.length, b.length %3C= 10%5E4%0AEach string is either %220%22 or doesn't contain any leading zero.%0A*/%0A%0Aclass Solution %7B%0A    public String addBinary(String a, String b) %7B%0A        %0A        int carry = 0;%0A        StringBuilder sb = new StringBuilder();%0A        int i = a.length() - 1, j = b.length() - 1;%0A        %0A        while(i %3E= 0 %7C%7C j %3E= 0 %7C%7C carry != 0)%7B%0A            int sum = carry;%0A            %0A            if(i%3E=0) %7B%0A                sum += a.charAt(i) - '0';%0A                i--;%0A            %7D%0A            %0A            if(j%3E=0) %7B%0A                sum += b.charAt(j) - '0';%0A                j--;%0A            %7D%0A            %0A            carry = sum / 2;%0A            if(sum %252 == 0) %7B%0A                sb.append('0');%0A            %7D else %7B%0A                sb.append('1');%0A            %7D%0A        %7D%0A        %0A        return sb.reverse().toString();%0A    %7D%0A%7D

add p67