leetcode
67. Add Binary
Given two binary strings, return their sum (also a binary string).
The input strings are bothnon-emptyand contains only characters1or0.
Example 1:
Input:a = "11", b = "1"Output:"100"
Example 2:
Input:a = "1010", b = "1011"Output:"10101"
今天小斌刷了一道题,这道题目要求我们把两个二进制的数值进行相加,题目非常简单,我是这样做得,直接把它们转化为十进制后进行相加,然后转换为二进制,办法虽然笨,不过竟然超越了百分之90的同行代码,小斌我也是非常吃惊,这种思路非常笨拙,有好想法的同志们欢迎一起交流,私聊的有木有