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:]
以上