class Solution {
public:
int findMinDifference(vector<string>& timePoints) {
vector<int> minutes;
for (auto timePoint: timePoints) {
int hour = stoi(timePoint.substr(0, 2));
int minute = stoi(timePoint.substr(3));
minutes.push_back(hour * 60 + minute);
}
sort(minutes.begin(), minutes.end());
minutes.push_back(minutes[0] + 24 * 60);
int res = INT_MAX;
for (int i = 1; i < minutes.size(); i++) {
int t = minutes[i] - minutes[i - 1];
res = min(res, t);
}
return res;
}
};