✅⬆️  [JAVA/C++/PY] 100 % | 0 MS | faster | simple | TIME & SPACE O(1)
UPVOTE PLEASE \n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- 
# UPVOTE PLEASE \n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\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 {\n    public int countTime(String time) {\n        if(time.equals("??:??")) return 1440;\n        int ans=1;\n        if(time.charAt(0)==\'?\' && time.charAt(1)==\'?\') ans*=24;\n        else if(time.charAt(0)==\'?\') ans*=(time.charAt(1)-\'0\'>=4)?2:3;\n        else if(time.charAt(1)==\'?\') ans *=(time.charAt(0)-\'0\'>=2)?4:10;\n        if(time.charAt(3)==\'?\') ans *=6;\n        if(time.charAt(4)==\'?\') ans *=10;\n        return ans;\n    }\n}\n\n\nCPP:\n\nint countTime(string time) {\n        if(time=="??:??") return 1440;\n        int ans=1;\n        if(time[0]==\'?\' && time[1]==\'?\') ans*=24;\n        else if(time[0]==\'?\') ans*=(time[1]-\'0\'>=4)?2:3;\n        else if(time[1]==\'?\') ans *=(time[0]-\'0\'>=2)?4:10;\n        if(time[3]==\'?\') ans *=6;\n        if(time[4]==\'?\') ans *=10;\n        return ans;\n    }\n\n\nPY :\n\ndef countTime(self, time: str) -> int:\n        if(time=="??:??"): return 1440;\n        ans=1;\n        if(time[0]==\'?\' and time[1]==\'?\'): ans=ans*24;\n        elif (time[0]==\'?\'):  \n            if(ord(time[1])-ord(\'0\')>=4): ans =  ans*2; \n            else: ans=ans*3;\n        elif (time[1]==\'?\'):  \n            if(ord(time[0])-ord(\'0\')>=2): ans = ans*4;\n            else:ans= ans*10;\n        if(time[3]==\'?\'): ans = ans * 6;\n        if(time[4]==\'?\'): ans = ans * 10;\n        return ans;CPP\n```
['Python', 'C++', 'Java', 'Python3']