Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in the list.
&nbsp;
Example 1:
Input: timePoints = ["23:59","00:00"]
Output: 1
Example 2:
Input: timePoints = ["00:00","23:59","00:00"]
Output: 0

&nbsp;
Constraints:


	2 &lt;= timePoints.length &lt;= 2 * 104
	timePoints[i] is in the format "HH:MM".


class Solution:
	def findMinDifference(self, timePoints: List[str]) -> int:
		timePoints.sort()

		def getTimeDiff(timeString1, timeString2):
			time1 = int(timeString1[:2]) * 60 + int(timeString1[3:])
			time2 = int(timeString2[:2]) * 60 + int(timeString2[3:])

			minDiff = abs(time1 - time2)

			return min(minDiff, 1440 - minDiff)

		result = getTimeDiff(timePoints[0], timePoints[-1]) # edge case, we need to check minDiff of first and last time after sorting

		for i in range(len(timePoints)-1):
			curMin = getTimeDiff(timePoints[i], timePoints[i+1])

			if curMin < result:
				result = curMin

		return result
		
class Solution {
    public int findMinDifference(List<String> timePoints) {
        int N = timePoints.size();
        int[] minutes = new int[N];
        for(int i = 0; i < N; i++){
            int hr = Integer.parseInt(timePoints.get(i).substring(0, 2));
            int min = Integer.parseInt(timePoints.get(i).substring(3, 5));
            minutes[i] = hr * 60 + min;
        }
        Arrays.sort(minutes);
        int res = Integer.MAX_VALUE;
        for(int i = 0; i < N - 1; i++){
            res = Math.min(res, minutes[i + 1] - minutes[i]);
        }
        int b = minutes[0];
        int a = minutes[N - 1];
        return Math.min(res, (b - a + 1440) % 1440);
    }
}
class Solution {
public:
    int findMinDifference(vector<string>& timePoints) {
        unordered_set<string> st;
        for(auto &i: timePoints)
        {
            if(st.count(i)) return 0;
            st.insert(i);
        }
        int ans = INT_MAX;
        int first = -1,prev = 0; // first variable will take the diffrence of the first time stamp given in the input and 00:00
        int hour = 0, minute = 0;
        while(hour<24)
        {
            minute=0;
            while(minute < 60)
            {
                string hh = to_string(hour), mm = to_string(minute);
                if(hh.size() == 1) hh = '0' + hh;
                if(mm.size() == 1) mm = '0' + mm;
                string p = hh + ":"+ mm;
                if(st.count(p))
                {
                    if(first == -1){first = prev;}
                    else
                    {
                        ans = min(ans,prev);
                    }
                    prev = 0;
                }
                prev++;
                minute++;
            }
            hour++;
        }
        ans = min(first+prev,ans);
        return ans;
    }
};
var findMinDifference = function(timePoints) {
    const DAY_MINUTES = 24 * 60;
    const set = new Set();

    for (let index = 0; index < timePoints.length; index++) {
        const time = timePoints[index];
        const [hours, minutes] = time.split(':');
        const totalMinutes = hours * 60 + +minutes;
        if (set.has(totalMinutes)) return 0;
        set.add(totalMinutes);
    }

    const timeMinutes = [...set].sort((a, b) => a - b);
    return timeMinutes.reduce((min, time, index) => {
        const next = timeMinutes[index + 1];
        const diff = next ? next - time : DAY_MINUTES - time + timeMinutes[0];
        return Math.min(min, diff);
    }, Infinity);
};
Minimum Time Difference