67. Add Binary
Given two binary strings, return their sum (also a binary string).
The input strings are both non-empty and contains only characters 1 or 0.

class Solution(object): def addBinary(self, a, b): """
:type a: str :type b: str :rtype: str """ out = int(a, 2) + int(b,2) return bin(out)[2:]
以上
浙公网安备 33010602011771号