首页 > 其他 > 详细

14.leetcode67_add_binary

时间:2018-02-06 23:55:17      阅读:297      评论:0      收藏:0      [点我收藏+]

1.题目描述

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

做二进制加法

2.题目分析

这个题偷懒了,直接进行了进制转换

3.解题思路

 1 class Solution(object):
 2     def addBinary(self, a, b):
 3         """
 4         :type a: str
 5         :type b: str
 6         :rtype: str
 7         """
 8         a1=int(a,2)
 9         b1=int(b,2)
10         s=a1+b1
11         s={0:b}.format(s)
12         return s

 

14.leetcode67_add_binary

原文:https://www.cnblogs.com/19991201xiao/p/8424676.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!