Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def findMinDifference(self, timePoints):
- """
- :type timePoints: List[str]
- :rtype: int
- """
- DAYINMINUTES = 24 * 60
- minutes = []
- for t in timePoints:
- hour, minute = t.split(":")
- minutes.append(int(hour) * 60 + int(minute))
- minutes.sort()
- minDiff = DAYINMINUTES
- for i in range(0, len(minutes) - 1):
- minDiff = min(minDiff, minutes[i+1] - minutes[i])
- overDayMinDiff = minutes[0] + (DAYINMINUTES - minutes[-1])
- return min(minDiff, overDayMinDiff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement