-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
https://github.com/mengli/leetcode/blob/master/ImplementStrStr.java#L22
Thanks for your code. But I found an issue in you code, as below snippet:
if (a >= len1 || haystack.charAt(a) != needle.charAt(b)) {
match = false;
break;
}
I think that we can change it to:
if ( haystack.charAt(a) != needle.charAt(b)) {
if (a >= len1) return null;
match = false;
break;
}
will make sense.
Metadata
Metadata
Assignees
Labels
No labels