2025-08-24 12:44:03 +0300 MSK
Convert Date to Binary
Links
Code
class Solution:
def convertDateToBinary(self, date: str) -> str:
res, cur = [], []
for num in map(int, (date[:4], date[5:7], date[-2:])):
while num > 0:
cur.append(num % 2)
num //= 2
cur.reverse()
res.append("".join(map(str, cur)))
cur.clear()
return "-".join(res)