✅C++ | Simple Solution Easy To Understand
\n# Approach\nSimple Maths\n# Complexity\n- Time complexity:O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complex
\n# Approach\nSimple Maths\n# Complexity\n- Time complexity:O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int countTime(string time) {\n     int ans=1;\n       \n       if(time[0]==\'?\' and time[1]!=\'?\')\n       {\n           if(time[1]>=\'4\' )\n           ans*=2;\n           else\n               ans*=3;\n       }\n        if(time[1]==\'?\' )\n        {\n            if(time[0]==\'1\')\n            ans*=10;\n            else if(time[0]==\'2\')\n            {\n                ans*=4;\n            }\n            else if(time[0]==\'0\')\n            {\n                ans*=10;\n            }\n            else\n            {\n                ans*=24;\n            }\n        }\n        if(time[3]==\'?\' and time[4]!=\'?\')\n            ans*=6;\n        if(time[4]==\'?\')\n        {\n            if(time[3]==\'?\')\n            {\n                ans*=60;\n            }\n            else \n            {\n                ans*=10;\n            }\n           \n        }\n        return ans;\n    }\n};\n```
['C++']