https://leetcode.com/problems/convert-date-to-binary/description/
1
2
3
4
5
|
class Solution:
def convertDateToBinary(self, date: str) -> str:
yyyy, mm, dd = map(int, date.split("-"))
return bin(yyyy)[2:]+"-"+bin(mm)[2:]+"-"+bin(dd)[2:]
|
cs |
python 내장함수 bin을 통해 구현
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1684. Count the Number of Consistent Strings (0) | 2024.09.12 |
---|---|
leetcode 3270. Find the Key of the Numbers (0) | 2024.09.02 |
백준 31994 강당 대관 (0) | 2024.07.15 |
백준 32025 체육은 수학과목 입니다 (0) | 2024.07.15 |
백준 30979 유치원생 파댕이 돌보기 (0) | 2024.06.19 |
댓글