C++ straightforward 3 lines
See my latest update in repo LeetCode\n## Solution 1.\n\n1. Convert the startTime and finishTime into minutes.\n2. If startTime > finishTime, add 24 hours to fi
See my latest update in repo [LeetCode](https://github.com/lzl124631x/LeetCode)\n## Solution 1.\n\n1. Convert the `startTime` and `finishTime` into minutes.\n2. If `startTime > finishTime`, add 24 hours to `finishTime` because we played overnight.\n3. Divide `startTime` and `finishTime` by 15, and round them UP and DOWN respectively. In this way we round the `startTime` and `endTime` to their next/previous closest 15-minute rounds, respectively. So `floor(finish / 15) - ceil(start / 15)` is number of rounds inbetween. \n\nNote that if `startTime` and `finishTime` are in the same 15-minute round, the above returns `-1`. We should return `max(0, floor(finish / 15) - ceil(start / 15))`\n\n```cpp\n// OJ: https://leetcode.com/contest/weekly-contest-246/problems/the-number-of-full-rounds-you-have-played/\n// Author: github.com/lzl124631x\n// Time: O(1)\n// Space: O(1)\nclass Solution {\npublic:\n    int numberOfRounds(string s, string f) {\n        int start = 60 * stoi(s.substr(0, 2)) + stoi(s.substr(3)), finish = 60 * stoi(f.substr(0, 2)) + stoi(f.substr(3));\n        if (start > finish) finish += 60 * 24; // If `finishTime` is earlier than `startTime`, add 24 hours to `finishTime`.\n        return max(0, finish / 15 - (start + 14) / 15); // max(0, floor(finish / 15) - ceil(start / 15))\n    }\n};\n```
[]