일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 괜찮음
- 영어공부
- Writing
- 30분
- 화상영어
- 뭐든
- 프로젝트
- 월간
- 파비최
- 10분
- FIT XR
- 3줄정리
- 매일
- 스탭퍼
- 운동
- 링피트
- 미드시청
- realclass
- 읽기
- 영어원서읽기
- 개발자
- Problem Solving
- 만화도
- 잡생각
- 리얼 클래스
- Daily Challenge
- 사이드
- leetcode
- English
- 쓰릴오브파이트
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.02.14 Today's Challenge 본문
https://leetcode.com/problems/add-binary/
Add Binary - LeetCode
Can you solve this real interview question? Add Binary - Given two binary strings a and b, return their sum as a binary string. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" Constraints: *
leetcode.com
파이썬 내장 함수를 활용하면 매우 편하게 풀 수 있음.
class Solution:
def addBinary(self, a: str, b: str) -> str:
return bin(int(a, 2) + int(b, 2))[2:]
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.02.16 Today's Challenge (1) | 2023.02.16 |
---|---|
2023.02.15 Today's Challenge (0) | 2023.02.15 |
2023.02.13 Today's Challenge (0) | 2023.02.13 |
2023.02.12 Today's Challenge (0) | 2023.02.12 |
2023.02.11 Today's Challenge (0) | 2023.02.11 |
Comments