Basic Solution
I saw a few different solutions that were a bit different from mine, but here\'s what I did in C++. This helps enumerate the conversion of string to ints (minut
I saw a few different solutions that were a bit different from mine, but here\'s what I did in C++. This helps enumerate the conversion of string to ints (minutes), account for the wrap around, and then adjust for the start time if it happens to be off.\n\n# Code\n```\nclass Solution {\npublic:\n    // if logout < login, then it wraps around\n    int numberOfRounds(string loginTime, string logoutTime) {\n        int rounds = 0;\n\n        // convert times into total minutes\n        int hour = std::stoi(loginTime.substr(0, 2));\n        int min = std::stoi(loginTime.substr(3, 2));\n        int startTime = hour*60 + min;\n\n        hour = std::stoi(logoutTime.substr(0, 2));\n        min = std::stoi(logoutTime.substr(3, 2));\n        int endTime = hour*60 + min;\n\n        if (endTime < startTime) \n        {\n            endTime += 1440;\n        }\n    \n        // get leftover and adjust\n        int lft = 15 - (startTime % 15);\n        startTime += (lft == 15) ? 0 : lft;\n\n        // loop through until we exceed/meet the end time\n        while (startTime <= endTime)\n        {\n            if (startTime + 15 > endTime)\n                break;\n            ++rounds;\n            startTime += 15;\n        }\n\n        return rounds;\n    }\n};\n```
['C++']