Very easy if and else
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
```java []
class Solution {
    public int countTime(String time) {
        int hours = 1, minutes = 1;
        
        // Handle HH (Hours)
        if (time.charAt(0) == '?' && time.charAt(1) == '?') {
            hours = 24; // "??" can be anything from 00 to 23
        } else if (time.charAt(0) == '?') {
            if (time.charAt(1) >= '4') {  // ?4, ?5, ?6 ... ?9 => 0 or 1
                hours = 2;
            } else {  // ?0, ?1, ?2, ?3 => 0, 1, or 2
                hours = 3;
            }
        } else if (time.charAt(1) == '?') {
            if (time.charAt(0) == '2') {  // 20, 21, 22, 23 => 0 to 3
                hours = 4;
            } else {  // 00-19 => 0 to 9
                hours = 10;
            }
        }

        // Handle MM (Minutes)
        if (time.charAt(3) == '?' && time.charAt(4) == '?') {
            minutes = 60; // "??" can be anything from 00 to 59
        } else if (time.charAt(3) == '?') {
            minutes = 6; // "?X" can be 00-59 => first digit must be 0-5
        } else if (time.charAt(4) == '?') {
            minutes = 10; // "X?" can be 00-59 => second digit can be 0-9
        }

        return hours * minutes;
    }
}

```
['Java']