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' 카테고리의 다른 글
3285. Find Indices of Stable Mountains (0) | 2024.09.21 |
---|---|
3190. Find Minimum Operations to Make All Elements Divisible by Three (0) | 2024.09.19 |
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 |
댓글