Backtracking 97% Faster Javascript version of Official solution ES6
Approach: Backtracking\nAlgorithm:\n- Initiate 3 pointers: \n\tpointer for pattern-index\n\tpointer for string-index\n\tpointer for temporary-index when we enco
`Approach:` Backtracking\n`Algorithm:`\n- Initiate 3 pointers: \n\tpointer for pattern-index\n\tpointer for string-index\n\tpointer for temporary-index when we encounter "*" in pattern\n- Initiate a variable for storing index-position of star "*"\n- both string pointer and pattern pointer are moved forward by 1 step whenever:\n\tchars in string and pattern match OR\n\tchar in string matches with "?" in pattern\n- Only pattern pointer is moved by a step when we encounter a "*"\n- Only string pointer is moved when a char  doesn\'t match with char in pattern\n- The starIndex acts as a reference point during entire iteration\n- The temp-index along with string-index are constantly updated when chars in pattern and string do not match. \n\n`Code:`\n```\nconst isMatch = function (string, pattern) {\n  let s = 0, p = 0;\n  let starIdx = -1, pointer = -1;\n\n  while (s < string.length) {\n    if ((p < pattern.length && string[s] === pattern[p]) || pattern[p] === "?") {\n      s++;\n      p++;\n    } \n\telse if (p < pattern.length && pattern[p] === "*") {\n      starIdx = p;\n      pointer = s;\n      p++;\n    } \n\telse if (starIdx === -1) return false;\n    else {\n      p = starIdx + 1;\n      s = pointer + 1;\n      pointer = s;\n    }\n  }\n  for (let idx = p; idx < pattern.length; idx++) {\n    if (pattern[idx] !== "*") return false;\n  }\n  return true;\n};\n```\n![image](https://assets.leetcode.com/users/images/c629aa14-6b86-48a5-a535-ff42e006c84e_1621887091.1771438.png)\n
['Backtracking', 'JavaScript']