• API
• FAQ
• Tools
• Archive
daily pastebin goal
8%
SHARE
TWEET

# Untitled

a guest Jan 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. class Solution(object):
2.     def findMinDifference(self, timePoints):
3.         """
4.        :type timePoints: List[str]
5.        :rtype: int
6.        """
7.         DAYINMINUTES = 24 * 60
8.
9.         minutes = []
10.         for t in timePoints:
11.             hour, minute = t.split(":")
12.             minutes.append(int(hour) * 60 + int(minute))
13.         minutes.sort()
14.
15.         minDiff = DAYINMINUTES
16.         for i in range(0, len(minutes) - 1):
17.             minDiff = min(minDiff, minutes[i+1] - minutes[i])
18.
19.         overDayMinDiff = minutes[0] + (DAYINMINUTES - minutes[-1])
20.         return min(minDiff, overDayMinDiff)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top