<LeetCode><Easy> 67 Add Binary

来源:互联网 发布:一口吃个胖子 知乎 编辑:程序博客网 时间:2024/05/21 08:47

Given two binary strings, return their sum (also a binary string).

For example,
a = "11"
b = "1"

Return "100".

#Python2   48ms

class Solution(object):    def addBinary(self, a, b):        """        :type a: str        :type b: str        :rtype: str        """        return bin(int(a,2)+int(b,2))[2:]


0 0