Simple Brute Force approach
The approach is quite straightforward, we simply try to imitate a clock. The complete steps of the algorithm are :\n1. We will iterate over the minutes, startin
The approach is quite straightforward, we simply try to imitate a clock. The complete steps of the algorithm are :\n1. We will iterate over the minutes, starting from the ```startTime```\'s minute, and increament minute at each step.Also maintaine a `play` variable showing the number of rounds we played.\n2. **Caution with iteration** : \n\ta. Since the minutes can\'t be more than ```59```, so when ```minutes == 60```, we would reset back ```minutes``` to ```0``` and increase `hour` by ```1```.\n\tb. Also since `hour <= 23` so when ```hour == 24``` we would reset ```hour``` to `0`, signifying we are in the next day.\n3. Every time, we hit the condition ```minute % 15 == 0``` we would increase `play` by `1`.\n4. End the loop when our timer becomes equal to ```endTime```.\n\nBelow is the Java implementation of above logic \uD83D\uDC47\n\n```java\nclass Solution {\n    public int numberOfRounds(String startTime, String endTime) {\n        int play = 0;\n\t\t\n\t\t// for easier working, startTime is converted to start[] and endTime is converted to end[]\n\t\t// where start[0] = startTime.hour, start[1] = startTime.minute\n\t\t// similarly end[0] = endTime.hour, end[1] = endTime.minute\n\t\t\n        int start[] = new int[2];\n        int end[] = new int[2];\n        start[0] = (startTime.charAt(0) - \'0\') * 10 + (startTime.charAt(1) - \'0\');\n        start[1] = (startTime.charAt(3) - \'0\') * 10 + (startTime.charAt(4) - \'0\');\n        end[0] = (endTime.charAt(0) - \'0\') * 10 + (endTime.charAt(1) - \'0\');\n        end[1] = (endTime.charAt(3) - \'0\') * 10 + (endTime.charAt(4) - \'0\');\n        \n        int hr = start[0];\n        for(int min = start[1]; ; min++) {\n            if(min % 15 == 0) play++;\n            if(min == 60) {\n                hr++;\n                min = 0;\n            }\n            if(hr == 24) {\n                hr = 0;\n            }\n            if(hr == end[0] && min == end[1]) {\n                break;\n            }\n        }\n        return (play < 1) ? 0 : play - 1;\n\t\t// returning play - 1 because play shows number of instances where minutes was divisible by 15, \n\t\t// and for every 2 consecutive instances you play 1 game, so play - 1.\n    }\n}\n```
[]