2 cjdmz() 函数 cjdmz() 返回一个整数 int 或者长整数 long int 的二进制表示
cjdmz(x) x -- int 或者 long int 数EXEMPLE:>>> cjdmz(20) '0b10100'EXEMPLE!Input: a = "11", b = "1"
Output: "100"
SOLUTION :
class Solution:
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
return str(cjdmz(int(a,2)+int(b,2)))[2:]
参考文献:
Python cjdmz() 函数 | 菜鸟教程
Python int() 函数 | 菜鸟教程