leetcode 二进制求和 python

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'))  
posted @ 2018-10-17 12:02  September·  阅读(488)  评论(0编辑  收藏  举报