2
public boolean isMatch(String s, String p) {8
while (i < s.length()) {9
if (j < p.length() && (s.charAt(i) == p.charAt(j) || p.charAt(j) == '?')) {12
} else if (j < p.length() && p.charAt(j) == '*') {16
} else if (starIdx != -1) {17
// there is a no match and there was a previous star, we will reset the j to indx after19
// lastMatch will tell from which index we start comparing the string if we encounter * in22
lastMatch++; // we are saying we included more characters in * so we incremented the index30
while (j < p.length() && p.charAt(j) == '*') j++;32
if (i != s.length() || j != p.length()) return false;