Minimum Time Difference LeetCode solution in Python
1class Solution:2def findMinDifference(self, timePoints: List[str]) -> int:3# Convert time points to minutes since midnight and sort the list4minutes = sorted([int(time[:2]) * 60 + int(time[3:]) for time in timePoints])56# Calculate the minimum difference between adjacent time points7min_diff = float("inf")8for i in range(len(minutes) - 1):9diff = minutes[i + 1] - minutes[i]10if diff < min_diff:11min_diff = diff1213# Calculate the difference between the first and last time points14diff = (24 * 60 - minutes[-1] + minutes[0]) % (24 * 60)15if diff < min_diff:16min_diff = diff1718return min_diff