C++ || Recursive Solution || O(10^4) worst  T.C || neat clean code
\n#include <string>\nclass Solution {\npublic:\n    \n    int recur(int i, string &time, int n){\n        \n        if(i >= n){\n            int a = 0, b = 0;\n
```\n#include <string>\nclass Solution {\npublic:\n    \n    int recur(int i, string &time, int n){\n        \n        if(i >= n){\n            int a = 0, b = 0;\n            \n            int f = time[0] - \'0\';\n            int ff = time[1] - \'0\';\n            int g = time[3] - \'0\';\n            int gg = time[4] - \'0\';\n        \n            int d = f*10 + ff;\n            int e = g*10 + gg;\n            \n            return (d >= 0 && d<=23 && e>=0 && e<=59);\n        }\n        \n        if(time[i] == \'?\'){\n            int cnt = 0;\n            for(int j = 0; j<10; j++){\n                time[i] = char(\'0\' + j);\n                cnt += recur(i + 1, time, n);\n                time[i] = \'?\';\n            }\n            return cnt;\n        }\n        \n        return recur(i + 1, time, n);\n    }\n    \n    int countTime(string time) {\n        int n = time.length();\n        return recur(0, time, n);\n    }\n};\n```
[]