We are given a list of time points in HH:MM format, representing times on a 24-hour clock.
Our task is to find the minimum difference in minutes between any two distinct positions in the list.
Rules:
0:00 and 3:59.3:59 comes 0:00.Important observation:
A 24-hour clock contains exactly:
We can convert every time point into an integer representing the number of minutes elapsed since midnight.
For a time HH:MM:
For example:
time = "13:05"hour = 13minute = 5total_minutes = 13 * 60 + 5# 785
Now, instead of comparing strings, we compare integers.