Skip to content

Commit 76fb5c7

Browse files
authored
Merge pull request #1390 from ivan1016017/septembe10
adding algo
2 parents 47fd82c + 250dc0d commit 76fb5c7

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from typing import List, Union, Collection, Mapping, Optional
2+
from abc import ABC, abstractmethod
3+
4+
class Solution:
5+
def addBinary(self, a: str, b: str) -> str:
6+
7+
return bin(int(a,2) + int(b,2))[2:]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import unittest
2+
from src.my_project.interviews.top_150_questions_round_19\
3+
.add_binary import Solution
4+
5+
class AddBinaryTestCase(unittest.TestCase):
6+
7+
def test_add_binary(self):
8+
solution = Solution()
9+
output = solution.addBinary(a="11", b="1")
10+
target = "100"
11+
self.assertEqual(output, target)

0 commit comments

Comments
 (0)