Untitled

 avatar
unknown
plain_text
a year ago
486 B
5
Indexable
def solution(S, T):
   start = list(map(int, S.split(':')))
   end = list(map(int, T.split(':')))
   start_seconds = start[0]*3600 + start[1]*60 + start[2]
   end_seconds = end[0]*3600 + end[1]*60 + end[2]
   
   count = 0
   for i in range(start_seconds, end_seconds + 1):
       h, remainder = divmod(i, 3600)
       m, s = divmod(remainder, 60)
       time = "{:02d}:{:02d}:{:02d}".format(h, m, s)
       if len(set(time.replace(':', ''))) <= 2:
           count += 1
   return count
Editor is loading...
Leave a Comment