#539

Minimum Time Difference

specialist · 680 · lc medium +30 · verified · 62.6% accepted · 2,602 likes · top 64%

play →

Description

You are given a list of times in "HH:MM" 24-hour format. Return the smallest difference in minutes between any two times in the list, treating the clock as circular (e.g., the gap between "23:59" and "00:00" is 1 minute).

Example 1:

Input: timePoints = ["23:59","00:00"]
Output: 1

Example 2:

Input: timePoints = ["00:00","23:59","00:00"]
Output: 0

Code

1
2
3