Fastest non-DP solution with O(1) space
\n    def isWildcardMatch(self, s, p):\n        sn, pn = len(s), len(p)\n        si = pi = 0\n        save_si, save_pi = None, None\n        while si < sn:\n   
 \n    def isWildcardMatch(self, s, p):\n        sn, pn = len(s), len(p)\n        si = pi = 0\n        save_si, save_pi = None, None\n        while si < sn:\n            if pi < pn and (p[pi] == '?' or p[pi] == s[si]):\n                si += 1\n                pi += 1\n            elif pi < pn and p[pi] == '*':\n                # Meet "*", save si and pi, searching for next character\n                save_si, save_pi = si + 1, pi\n                pi += 1\n            elif save_pi is not None:\n                # Dead end, restore si and pi, carry on.\n                si, pi = save_si, save_pi\n            else:\n                return False\n        # Check trailing "*"\n        return p[pi:].count("*") == pn - pi
['Python']