1 2 3 4 5 6 7 8
| class Solution { public: int numberOfRounds(string startTime, string finishTime) { int start = 60 * stoi(startTime.substr(0, 2)) + stoi(startTime.substr(3)), finish = 60 * stoi(finishTime.substr(0, 2)) + stoi(finishTime.substr(3)); if (start > finish) finish += 60 * 24; return max(0, finish / 15 - (start + 14) / 15); };
|