Backtracking
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```python3 []
class Solution:
    def countTime(self, time: str) -> int:
        n=len(time)
        ans=0
        def trv(i,t):
            nonlocal ans
            if i==n:
                hh,mm=map(int,t.split(':'))
                if 0<=hh<=23 and 0<=mm<=59: 
                    ans+= 1
                return
            if time[i]!='?':
                trv(i+1,t+time[i])
            else:
                for d in range(0,10):
                    trv(i+1,t+str(d))
        trv(0,'')
        return ans
                    



```
['Python3']