Easy to understand solution in Java. Beats 100 %
Complexity

Time complexity:
O(1)


Space complexity:
O(1)

Code
# Complexity
- Time complexity:
O(1)

- Space complexity:
O(1)

# Code
```java []
class Solution {
    public int countTime(String time) {
        int answer = 1;
        if (time.charAt(0) == '?' && time.charAt(1) == '?') {
            answer *= 24;
        }

        if (time.charAt(0) == '?' && time.charAt(1) != '?') {
            answer *= time.charAt(1) < '4' ? 3 : 2;
        }

        if (time.charAt(1) == '?' && time.charAt(0) != '?') {
            answer *= time.charAt(0) == '2' ? 4 : 10;
        }

        if (time.charAt(3) == '?') {
            answer *= 6;
        }

        if (time.charAt(4) == '?') {
            answer *= 10;
        }
        return answer;
    }
}
```
['String', 'Java']