[C++] |  With comments & Examples | O(1) | 100% Faster
Handling just 2 cases takes care of every corner case. And by seeing some common parts in code and, you can make code shorter ,but I think its easy to understan
#### Handling just 2 cases takes care of every corner case. And by seeing some common parts in code and, you can make code shorter ,but I think its easy to understand this way\n```\nclass Solution {\npublic:\n    int numberOfRounds(string s, string f) {\n\t\t//Just Some preprocessing :-/\n        int sh = (s[0]-\'0\')*10 + (s[1]-\'0\');    //start hour\n        double sm = (s[3]-\'0\')*10 + (s[4]-\'0\'); //start minute\n        int fh = (f[0]-\'0\')*10 + (f[1]-\'0\');    //final hour\n        double fm = (f[3]-\'0\')*10 + (f[4]-\'0\'); //final minute\n        \n\t\t//changing the minutes bounds \n        sm = ceil(sm/15) * 15;  // for 12:01 it will become 12:15\n        fm = floor(fm/15) *15;  // for 14:07 it will become 14:00\n        int ret = 0;\n\t\t\n\t\t//preprocessing ends\n\t\t//condition of finish time higher than start time\n        if(fh>sh || (fh == sh && fm>=sm)){\n            if(fh == sh){ \n                // for 12:01(scales up to 12:15) - 12:44(scaled downto 12:30)  return (30 -15)/15;\n                return (fm -sm)/15;    \n            }\n            // for 12:05 {==> 12:15} - 14:22 {==> 14:15 } \n            \n            ret = ret + 4*(fh-(sh+1));           // calculate from (14 to 12+1)\n            ret = ret + (60-sm)/15 + fm/15;      // add minutes from 12:15 - 13:00 && 14:00 - 14:15\n        }\n        else{\n            // ex : 20:15 - 6:42 { becomes 6:30}\n            // add hours from 20:00 - 24:00 (added extra round 20:00 - 20:15 , so have to substract it)\n            //add hours from 24:00 - 6:00 \n            ret = ret + 4*(24 - sh) + 4*fh;\n            \n            //substracting the extra round and adding extra round from 6:00 - 6:30\n            ret = ret - (sm)/15 + fm/15;\n            \n        }\n        return ret;\n    }\n};\n```
[]