1
var isMatch = function (s, p) {6
const solve = (si = 0, pi = 0) => {7
// both are compared and are equal till end8
if (si == slen && pi == plen) return true;9
// we have consumed are wildcard string and still s is remaining10
if (pi == plen) return false;11
// we still have wildcard characters remaining13
while (p[pi] == "*") pi++;17
const key = [si, pi].join(":");18
if (dp.has(key)) return dp.get(key);23
ans = solve(si, pi + 1) || solve(si + 1, pi);25
const match = s[si] == p[pi] || p[pi] == "?";26
if (match) ans = solve(si + 1, pi + 1);