[leetcode][67] Add Binary

    xiaoxiao2021-03-26  26

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

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

    Return "100".

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

    转载请注明原文地址: https://ju.6miu.com/read-350328.html

    最新回复(0)