Concise JAVA solution
Explanation\n\nThe basic idea is to check and advance two pointers in two strings correspondingly if satisfying specific condition. And the trick part is the at
**Explanation**\n\nThe basic idea is to check and advance two pointers in two strings correspondingly if satisfying specific condition. And the trick part is the attempting backtracking method for '*' matching, which can be checked out in the code. Thanks for this great idea from [Yu][1] and [pandora][2].\n\n    public boolean isMatch(String str, String pattern) {\t\t\n        int s = 0, p = 0, pStar = -1, sMatchStar = 0; // s is the pointer index of str; p is the pointer index of pattern.\n        while (s < str.length()){ \n        \t// Advancing both pointers: if current pointer of pattern is '?', or current two pointers match\n            if (p < pattern.length() && (pattern.charAt(p) =='?' || pattern.charAt(p)==str.charAt(s))){\n                s++;\n                p++;\n            } \n            else if (p < pattern.length() && pattern.charAt(p) == '*') {\n            \t// Only advancing pattern pointer, and track index of '*': if current pointer of pattern is '*'\n                pStar = p; \n                sMatchStar = s;\n                p++;\n            } \n            else if (pStar != -1){// Only advancing string pattern : if last pattern was '*'\n                p = pStar + 1;  // If current characters didn't match, try to backtrack p to '*' + 1\n                sMatchStar++;     \n                s = sMatchStar; // Backtrack s to last index matching '*' + 1\n            } \n            // Characters didn't match: 1) Current two pointers didn't match; 2) No '?' found; 3) No '*' found.\n            else return false;\n        }\n    \n        // Check the remaining characters in pattern: only advancing with '*'\n        while (p < pattern.length() && pattern.charAt(p) == '*')\n        \tp++;\n        // Characters only match if the pattern reaches its end.\n        return p == pattern.length();  \n    }\n\n  [1]: http://%20http://yucoding.blogspot.com/2013/02/leetcode-question-123-wildcard-matching.html\n  [2]: https://leetcode.com/discuss/10133/linear-runtime-and-constant-space-solution
[]