@@ -0,0 +1,1310 @@
+package leetcode;%0A%0Aimport java.util.Stack;%0A%0A/**%0A * https://oj.leetcode.com/problems/add-binary/%0A */%0Apublic class Problem67 %7B%0A    public String addBinary(String a, String b) %7B%0A        int diff = Math.abs(a.length() - b.length());%0A        String zeroes = %22%22;%0A        for (int i = 0; i %3C diff; i++) %7B%0A            zeroes += %220%22;%0A        %7D%0A        if (a.length() %3E b.length()) %7B%0A            b = zeroes + b;%0A        %7D else if (a.length() %3C b.length()) %7B%0A            a = zeroes + a;%0A        %7D%0A        Stack%3CInteger%3E stack = new Stack%3C%3E();%0A        boolean carry = false;%0A        // by now a's length should be the same as b's length%0A        for (int i = a.length()-1; i %3E= 0; i--) %7B%0A            int x = (a.charAt(i) == '1') ? 1 : 0;%0A            int y = (b.charAt(i) == '1') ? 1 : 0;%0A            int val = x + y;%0A            if (carry) %7B%0A                val += 1;%0A            %7D%0A            if (val %3E= 2) %7B%0A                stack.push(val %25 2);%0A                carry = true;%0A            %7D else %7B%0A                stack.push(val);%0A                carry = false;%0A            %7D%0A        %7D%0A        if (carry) %7B%0A            stack.push(1);%0A        %7D%0A        StringBuilder result = new StringBuilder();%0A        while (!stack.isEmpty()) %7B%0A            result.append(stack.pop());%0A        %7D%0A        return result.toString();%0A    %7D%0A%7D%0A

Solve poblem 67