본문 바로가기
python-algorithm

leetcode 3280. Convert Date to Binary

by 무적김두칠 2024. 9. 12.

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을 통해 구현

반응형

댓글