C++ 4ms 98% solution w/ explanation
This is basically an optimized DFS approach, that aims to greedily minimize the amount of characters that each * matches. The overall run-time is O(p*s), which 
This is basically an optimized DFS approach, that aims to greedily minimize the amount of characters that each ```*``` matches. The overall run-time is ```O(p*s)```, which is same as the DP approach, but it is much faster.\n\n**What makes this approach different from normal DFS**\n\nThe main difference is that we are _greedily cutting branches that would normally be explored in DFS_. In a normal DFS approach, we would try out different numbers of characters to skip in ```*```. In this approach, for any string in the form ```s1*s2*s3```, we would look for the _least number of characters to put in the first ```*``` such that we can match ```s1*s2```_. And that is the end for the first ```*```. The position for the first ```*``` is now set in stone. We proceed to look for the least number of characters in the second ```*``` such that we can match ```s1*s2*s3```, etc.\n\nIllustration:\n\nSay we have ```p = aba*ab```, s = ```abaababaab```\n\nWe first match ```aba```. Thus, we have remaining:\n\n```p = _*ab```\n```s = _abaabaab```\n\nWe try to match 0 characters to ```*```. We end up with:\n\n```p  = _ab```\n```s = _abaabaab```\n\nWe match ```ab```. This doesn\'t work, since we need to match the whole string. This implies that we need ```*``` to take more characters.\nEventually, we get ```ab``` to match the last two characters in ```s```, and we complete the match.\n\n**Why this optimization works (how do we know we will get a match if a match exists)**\n\nAssume we have string ```s = s1*s2*s3```, and it matches some pattern. Let\'s say the first index of the matching position of ```s3``` is ```j```, and the last index of the _latest_ matching position of ```s2``` is ```i```. Because ```s2``` is before ```s1```, and ```*``` between them implies there are 0 or more characters between them, we can see that ```i < j```. Assume there is an earlier match of ```s2```, ending at index ```k```. It is easy to see here that ```k < i < j```, which directly implies ```k < j```. Thus, by _greedily_ looking for the minimum number of characters to fit into ```*``` to get a match, we will get a solution if there is _any_ other combinations in which we put more characters to into ```*``` that also results in a match.\n\nThus, for every string ```s = s1*s2*s3...*sn(*)```, we get ```s1```, minimize the number of characters for ```*s2```, and then ```*s3```, ... until the last ```*```. At this point, we  simply need to check if ```sn``` matches the end of the pattern, or we have ```*``` at the end, and we can get any match and put the rest in ```*```.\n\n**Potential Improvement**\n\nThis solution is simple, but it may actually be possible to improve the run-time to ```O(s+p)``` by applying KMP to match ```s1*s2*s3...*sn-1```.\nOnce we are at ```*sn(*)```, we can either return true if there is any match if there is ```*``` at the end, or simply match ```sn``` to the same size segment at end of ```s``` if there is no ```*``` at the end.\n\n\n\n\n\n\n```\nclass Solution {\npublic:\n     bool isMatch(const string &s, const string &p) {\n        int sizeS = s.size(), sizeP = p.size(), lps = -1, lss = -1, i = 0, j = 0;\n        while(j < sizeS) {\n            if(i < sizeP && p[i] == \'*\') {\n                lps = ++i;\n                lss = j;\n            }\n            else if(i < sizeP && p[i] == s[j] || p[i] == \'?\') {++i; ++j;}\n            else {\n                if(lps == -1) return false;\n                j = ++lss;\n                i = lps;\n            }\n        }\n        while(p[i] == \'*\') ++i;\n        return i == sizeP;\n    }\n};\n\nauto gucciGang = []() {std::ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);return 0;}();\n```
[]