Development/Algorithm

[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:]

 

감사합니다.

반응형