No Math and magic numbers BS, Just check intersection of time ranges
TLDR: The algorithm is just checking intersection of time ranges. Not as efficient as the math approach, but easier to understand from pure algorithms perspecti
TLDR: The algorithm is just checking intersection of time ranges. Not as efficient as the math approach, but easier to understand from pure algorithms perspective.\n\nTrying to do the math and accomodate corner cases gets a little messy in my opinion, hence I let the in-built string comparisons do to the heavy lifting for us. \nThe solution is easy to understand, we just have to check whether the quarters fall in the time range. Therefore, generate all the quarters and for each one of them check if they fall in between the start and endTime. \n\n```python\nclass Solution:\n      \n    def numberOfRounds(self, startTime: str, finishTime: str) -> int:\n        res = 0\n        if startTime > finishTime:\n          res += self.find_intersecting_rounds(startTime, \'24:00\')\n          res += self.find_intersecting_rounds(\'00:00\', finishTime)\n        else:\n          res += self.find_intersecting_rounds(startTime, finishTime)\n        return res\n  \n    def find_intersecting_rounds(self, start, end):\n          start_hour, _   = [int(x) for x in start.split(\':\')]\n          end_hour, _     = [int(x) for x in end.split(\':\')]\n          count = 0\n          for current_hour in range(start_hour, end_hour+1):\n            quarters = [0, 15, 30, 45, 60]\n            for i in range(len(quarters) - 1):\n              first_q  = \'%02d:%02d\' % (current_hour, quarters[i])\n              second_q = \'%02d:%02d\' % (current_hour, quarters[i+1])\n              # 00:00 <= 00:15 <= 23:59 and 00:00 <= 00:30 <= 23.59\n              if (start <= first_q <= end) and (start <= second_q <= end):\n                count += 1\n          return count\n        \n```\n
['Python3']