class Solution:
def addBinary(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
a, b = int(a, 2), int(b, 2)
return bin(a + b)[2:]
i = Solution()
print(i.addBinary('1010', '1011'))
转载于:https://www.cnblogs.com/liang3044/p/9803306.html
最后
以上就是落寞长颈鹿最近收集整理的关于leetcode 二进制求和 python的全部内容,更多相关leetcode内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复