We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug Report for https://neetcode.io/problems/regular-expression-matching
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
My current solution is accepted on neetcode but it should fail for the following test case s = "a" p = "ab*"
class Solution { public static boolean isMatch(String s, String p) { return checkMatch(0, 0, s, p); } public static boolean checkMatch(int indS, int indP, String s, String p) { if(indS == s.length() && indP == p.length()) return true; if(indS >= s.length() || indP >= p.length()) return false; boolean isPossible = false; char schar = s.charAt(indS), pchar = p.charAt(indP); if(pchar >= 'a' && pchar <= 'z') { if(schar == pchar) { isPossible = isPossible | checkMatch(indS + 1, indP + 1, s, p); } else { isPossible = isPossible | checkMatch(indS, indP + 1, s, p); } } else if(pchar == '.') { isPossible = isPossible | checkMatch(indS + 1, indP + 1, s, p); } else { char prevChar = p.charAt(indP - 1); if(prevChar == '.') { isPossible = isPossible | checkMatch(indS + 1, indP, s, p) | checkMatch(indS + 1, indP + 1, s, p) | checkMatch(indS, indP + 1, s, p); } else { if(prevChar == schar) { isPossible = isPossible | checkMatch(indS + 1, indP, s, p) | checkMatch(indS + 1, indP + 1, s, p) | checkMatch(indS, indP + 1, s, p); } else { isPossible = isPossible | checkMatch(indS, indP + 1, s, p); } } } return isPossible; } }
The text was updated successfully, but these errors were encountered:
Thanks for the feedback! The testcase has been added to the backend and soon will reflect on the site.
Sorry, something went wrong.
No branches or pull requests
Bug Report for https://neetcode.io/problems/regular-expression-matching
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
My current solution is accepted on neetcode but it should fail for the following test case s = "a" p = "ab*"
The text was updated successfully, but these errors were encountered: