class Solution {
public int findMinDifference(List<String> timePoints) {
List<Integer> ms = new ArrayList<>();
for (String s : timePoints) ms.add(htom(s));
Collections.sort(ms);
int min = Integer.MAX_VALUE;
for (int i = 1; i < ms.size(); i++) {
min = Math.min(min, ms.get(i) - ms.get(i-1));
}
min = Math.min(min, 60*24 - ms.get(ms.size() - 1) + ms.get(0));
return min;
}
public int htom(String s) {
String[] strs = s.split(":");
int h = Integer.parseInt(strs[0]) * 60;
int m = Integer.parseInt(strs[1]);
return h + m;
}
}
/*
1) convert to minute representation; 2) sort asc; 3) calculate diff of 2 times, careful edge case, the last one to first one mighted be smaller;
*/