Python   ||   5 lines    T/S: 96% / 99%
Here\'s the plan: \n\n1. We use the boolean function f to determine whether a two-char str x is equal to a two-char str y when a \'?\' character (if any) is rep
Here\'s the plan: \n\n1. We use the boolean function `f` to determine whether a two-char str `x` is equal to a two-char str `y` when a \'?\' character (if any) is replaced with an appropriate digit.\n\n1. We use `split()` to determine the *hr* and *mn* portions of the string.\n2. We construct a set of zero left-justified single-digit strings.\n3. We construct sets for possible *hrs* and *mns* strings.\n4. We  use `f` to determine the numbers of the possible *hrs* and *mns*, and we return their product as the answer to the problem.\n\n```\nclass Solution:\n    def countTime(self, time: str) -> int:\n\n        f = lambda x,y: ((x[0] == \'?\' or x[0] == y[0]) and  # <-- 1)\n                         (x[1] == \'?\' or x[1] == y[1]))\n\n        hr, mn = time.split(\':\')                            # <-- 2)\n\n        zeros = {\'0\'+str(digit) for digit in range(10)}     # <-- 3)\n        \n        hrs = zeros|set(map(str,range(10,24)))              # <-- 4)\n        mns = zeros|set(map(str,range(10,60)))\n\n        return  (sum(f(hr, h) for h in hrs) *               # <-- 5)\n                 sum(f(mn, m) for m in mns))\n```\n[https://leetcode.com/problems/number-of-valid-clock-times/submissions/823847551/](https://leetcode.com/problems/number-of-valid-clock-times/submissions/823847551/)\n\n
['Python', 'Python3']