Javascript solutions
This is my original solution with help from here. It recursively goes through the two lists, and uses an object for memoization to help with performance.\n\n\nv
This is my original solution with help from [here](https://leetcode.com/problems/wildcard-matching/discuss/370736/Detailed-Intuition-From-Brute-force-to-Bottom-up-DP). It recursively goes through the two lists, and uses an object for memoization to help with performance.\n\n```\nvar isMatch1 = function(s, p) {\n    return helper(s, p, 0, 0, {})\n};\n\nlet helper = function(s, p, sIndex, pIndex, memo) {\n    if ("S" + sIndex + "P" + pIndex in memo) return memo["S" + sIndex + "P" + pIndex]\n    let res = false\n    if (pIndex == p.length && sIndex == s.length) res = true\n    else if (pIndex == p.length) res = false\n    else if (sIndex == s.length) res = p[pIndex] == "*" && helper(s, p, sIndex, pIndex + 1, memo)\n    else if (p[pIndex] == "*") res =  helper(s, p, sIndex, pIndex + 1, memo) || helper(s, p, sIndex + 1, pIndex, memo)\n    else if (s[sIndex] == p[pIndex] || p[pIndex] == "?") res = helper(s, p, sIndex + 1, pIndex + 1, memo)\n    else res = false\n    memo["S" + sIndex + "P" + pIndex] = res\n    return res\n}\n\nfunction allStars(input) {\n    return input && input.split(\'\').every(char => char === "*");\n}\n```\nThis is a javascript implmentation of [this solution](https://leetcode.com/problems/wildcard-matching/discuss/17810/Linear-runtime-and-constant-space-solution). It has the key insight that you only ever need to care about the most recent asterisk, and not every asterick. Thus we only need to keep track of that asterick, and reset whenever we hit a failure state.\n```\nvar isMatch2 = function(s, p) {\n    let sIndex = 0, pIndex = 0, star, ss = sIndex\n    while(sIndex < s.length) {\n        console.log(sIndex, pIndex, star, ss)\n        if (p[pIndex] == "?" || p[pIndex] == s[sIndex]) { sIndex++; pIndex++ }\n        else if (p[pIndex] == "*") { star = pIndex++; ss = sIndex }\n        else if (star != undefined) { pIndex = star + 1; sIndex = ++ss }\n        else return false\n    }\n    while(p[pIndex] == "*") {pIndex++}\n    return pIndex == p.length\n}\n```\n\nThis is a javascript implementation of [this solution](https://leetcode.com/problems/wildcard-matching/discuss/256025/Python-DP-with-illustration). It uses dp to keep track of which states are valid given the string/pattern seen up until that point.\n\n```\nvar isMatch3 = function(s, p) {\n    let dp = []\n    for (let i = 0; i < s.length + 1; i++) {\n        let arr = new Array(p.length + 1).fill(false)\n        dp.push(arr)\n    }\n    dp[0][0] = true\n    for (let i = 1; i < p.length + 1; i++) {\n        if(p[i - 1] != \'*\') break\n        else dp[0][i] = true\n    }\n    for (let i = 1; i < s.length + 1; i++) {\n        for (let j = 1; j < p.length + 1; j++) {\n            if (p[j - 1] == s[i - 1] || p[j - 1] == "?") {dp[i][j] = dp[i-1][j-1]}\n            else if (p[j - 1] == "*") {dp[i][j] = dp[i-1][j] || dp[i][j-1]}\n        }\n    }\n    return dp[s.length][p.length]\n}\n```\n\nHappy coding!\n
['JavaScript']