Each string in timePoints is a valid time on a 24-hour clock, written as HH:MM. Choose two different entries and return the smallest distance between their times, measured in minutes around the clock. The distance may cross midnight. Two entries with identical times have distance 0.
Example 1:
Input: timePoints = ["23:50","00:10"]
Output: 20Explanation: From 23:50 to midnight takes 10 minutes, and reaching 00:10 takes 10 more. The shorter distance is 20 minutes.
Example 2:
Input: timePoints = ["12:15","12:15"]
Output: 0Explanation: The two entries represent the same clock time, so their distance is 0 minutes.
Example 3:
Input: timePoints = ["06:00","18:00"]
Output: 720Explanation: The times are exactly half a day apart. Either direction around the clock takes 720 minutes.
Constraints:
2 <= timePoints.length <= 20000- Every entry is exactly five characters in
HH:MMformat. - Hours range from
00to23; minutes range from00to59.