Java clean, easy to think of, very clear explanation
I am fresh here. Using the most stupid way to solve this problem. Include the special cases need to solve \n\nclass Solution {\n    public int numberOfRounds(St
I am fresh here. Using the most stupid way to solve this problem. Include the special cases need to solve \n```\nclass Solution {\n    public int numberOfRounds(String start, String finish){\n        \n        //I am a fresh java user, do not know other ways to split the string\n        \n        // here we want sh = start hour, eh = end hour, sm = start min, em = end min\n        String[] res = start.split(":");\n        int sh = Integer.parseInt(res[0]);\n        int sm = Integer.parseInt(res[1]);\n        String[] res2 = finish.split(":");\n        int eh = Integer.parseInt(res2[0]);\n        int em = Integer.parseInt(res2[1]);\n        \n        //first we resolve the special case that he plays overnight, \n\t\t//that\'s the end hour is even bigger than the start hour, we plus 24\n        if(eh < sh)\n            eh = eh + 24;\n        \n        // the secpnd special case. The start and end hour is the same, but the minutes are different\n        if(eh == sh){\n            \n            // the first sub case, end is smaller than the start min, \n\t\t\t//we add 24 to the end hour, becasue it is playing overnight\n            if(em < sm)\n                eh = eh + 24;  \n            else{\n                \n                //the second sub case, end is bigger than the start min\n\t\t\t\t//we find the time left in the start hour for him to play for the start time\n\t\t\t\t//and the time he could play if he only have the end time\n\t\t\t\t//add these two together and subtract 4 ( it means 60 / 15) \n\t\t\t\t//can we get exactlly how many runs can he play in this hour\n\t\t\t\t\n                sm = (60 - sm) / 15;\n                em = em / 15;\n                return em + sm - 4;\n            \n            }      \n        }\n        \n        //for other cases, including the previous adding 24 hours cases, \n\t\t//we can consider the remaining time for him to play in the start hour\n\t\t//and the runs he can play in the end hour, and then \n\t\t//add the hours between the start and the end and subtract 1\n\t\t\n        int run1 = (60 - sm) / 15;\n        int run2 = em / 15;\n        int run = (eh - sh - 1) * 4 + (run1 + run2);\n        return run;\n    }\n}\n```
[]