[LeetCode] Add Binary

동스토리 ㅣ 2021. 8. 31. 04:47

반응형

안녕하세요.

 

LeetCode 67번 Add Binary 문제풀이 하겠습니다.

 

https://leetcode.com/problems/add-binary/

 

Add Binary - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

[문제]

 

[TestCase]

 

[해설]

 

[코드]

class Solution:
    def addBinary(self, a: str, b: str) -> str:
        
        a = int(a,2)
        b = int(b,2)
        
        return bin(a+b)[2:]

 

감사합니다.

반응형

'Development > Algorithm' 카테고리의 다른 글

[LeetCode] Sqrt(x)  (0) 2021.08.31
[LeetCode] Plus One  (0) 2021.08.31
[LeetCode] Length of Last Word  (0) 2021.08.31
[LeetCode] Search Insert Position  (0) 2021.08.26
[LeetCode] Implement strStr()  (0) 2021.08.26