Demo entry 6645132

python

   

Submitted by anonymous on Oct 09, 2017 at 09:33
Language: Python 3. Code size: 543 Bytes.

class Solution(object):
    def findMinDifference(self, timePoints):
        """
        :type timePoints: List[str]
        :rtype: int
        """
        _sum = lambda h, m: 60*int(h)+int(m)
        time_minutes = [_sum(*tp.split(':')) for tp in timePoints]
        time_minutes.sort()
        time_minutes.append(time_minutes[0]+1440)
        _rev = lambda d: d if d < 720 else 1440 - d
        diffs = [_rev(v - time_minutes[i-1]) for i, v in enumerate(time_minutes[1:], 1)]
        # print(diffs)
        return min(diffs)

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).