Java O(1) solution with comments in the code for better understanding
Here we\'re basically converting the startTime and endTime to minutes and then calculating then result.\n\nclass Solution {\n    public int numberOfRounds(Strin
Here we\'re basically converting the startTime and endTime to minutes and then calculating then result.\n```\nclass Solution {\n    public int numberOfRounds(String startTime, String finishTime) {\n        \n        int finMin = Integer.parseInt(finishTime.substring(3, 5));\n        int startMin = Integer.parseInt(startTime.substring(3,5));\n        int finHr = Integer.parseInt(finishTime.substring(0, 2));\n        int startHr = Integer.parseInt(startTime.substring(0, 2));\n        \n        int start = startHr * 60 + startMin; //converting start time to minutes\n        int end = finHr * 60 + finMin;  // converting endtime to minutes\n        \n        if(start % 15 != 0) {     // making start to next multiple of 15 \n            int div = start/15;   // doing this because in start time for example of 03:10(190 mins), \n            start = 15 * (div + 1);  //we can join the contest at 03:15(195 mins) only and 195 is next multiple of 15 after 190.\n        }\n        \n        if(end % 15 != 0) {  //doing the same here but instead of finding the next multiple we\'re rounding off to previous multiple of 15\n            int div = end/15; // as ending time of for example 03:10 we have to count till 03:00 because at 03:00 new game starts\n            end = 15 * div; // but it ends at 03:15 but our end time is 03:10\n        }\n        \n        if(end < start) end = end + 24*60;  //here if ending time < start time. see example 2 of the provided test cases.\n                                            // basically the game ends at next day so we added 24 more hours\n        \n        \n        return Math.abs(end - start) / 15; // now to find the number of games played we divide the time difference by 15\n    }\n}\n```
['Java']