Skip to content

Commit b432a9c

Browse files
committed
Updated wildcard matching
1 parent 6fd51bc commit b432a9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Hard/WildcardMatching.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public boolean isMatch(String str, String pattern) {
6666
if (str == null && pattern == null) return true;
6767
if (str == null || pattern == null) return false;
6868

69-
int s = 0, p = 0, match = 0, astroIdx = -1;
69+
int s = 0, p = 0, match = 0, astroIdx = -1; // must be -1
7070
while (s < str.length()) {
7171
if (p < pattern.length() && (pattern.charAt(p) == '?' || str.charAt(s) == pattern.charAt(p))){ // found ? or same chars
7272
s++; // move both pointers

0 commit comments

Comments
 (0)