[Python3] top-down dp
\n\nfrom functools import lru_cache \n\nclass Solution:\n    def isMatch(self, s: str, p: str) -> bool:\n        \n        @lru_cache(None)\n        def fn(i, j
\n```\nfrom functools import lru_cache \n\nclass Solution:\n    def isMatch(self, s: str, p: str) -> bool:\n        \n        @lru_cache(None)\n        def fn(i, j): \n            """Return True if s[i:] matches p[j:]"""\n            if j == len(p): return i == len(s)\n            if i < len(s) and (s[i] == p[j] or p[j] == "?"): return fn(i+1, j+1)\n            if p[j] == "*": return fn(i, j+1) or i < len(s) and fn(i+1, j)\n            return False \n        \n        return fn(0, 0)\n```\n\nThis is similar to but easier than [10. Regular Expression Matching](https://leetcode.com/problems/regular-expression-matching/discuss/652563/Python3-top-down-dp).
['Dynamic Programming', 'Python3']