Leedcode 67. 二进制求和 python3


a、b转10进制,求和,再转2进制输出

代码:

def addBinary(self, a: str, b: str) -> str:
    return bin(int(a, 2) + int(b, 2))[2:]
print(addBinary(str, '1010', '1011'))

原文地址:https://www.cnblogs.com/wrnan/p/12469227.html