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'))
相关文章
- LeetCode刷题 Python实现——常用内置算法和数据结构
- Leetcode0002--Add Two Numbers 链表求和
- 【LeetCode】337. House Robber III 解题报告(Python)
- [Leetcode][python]Triangle/三角形最小路径和
- LeetCode(Python)—— 二叉树的中序遍历(简单)
- LeetCode 94. 二叉树的中序遍历 Python
- LeetCode:263(Python)—— 丑数(简单)
- [leetcode]304. Range Sum Query 2D - Immutable二维区间求和 - 不变
- 【LeetCode】304. Range Sum Query 2D - Immutable 解题报告(Python)
- [leetcode]Interleaving String @ Python