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'))  

转载于:https://www.cnblogs.com/liang3044/p/9803306.html

你可能感兴趣的:(leetcode 二进制求和 python)