Skip to content

Commit 4243055

Browse files
fixes PMD
1 parent 0c4b83c commit 4243055

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/thealgorithms/Recursion/RegexMatchingRecursive.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ public boolean isMatch(String s, String p) {
1010
}
1111

1212
// Check if the first character of s matches the first character of p.
13-
boolean firstMatch = (!s.isEmpty() && (p.charAt(0) == s.charAt(0) || p.charAt(0) == '.'));
13+
boolean firstMatch = (!s.isEmpty() && p.charAt(0) == s.charAt(0) || p.charAt(0) == '.');
1414

1515
// So...If there's a '*' in the second position of p i.e., p.charAt(1) == '*'
1616
// it means we can either:
1717
// 1. Ignore the '*' and the preceding character (move to p.substring(2)).
1818
// 2. Use the '*' to match the first character of s if there's a match.
1919

2020
if (p.length() >= 2 && p.charAt(1) == '*') {
21-
return (isMatch(s, p.substring(2)) || (firstMatch && isMatch(s.substring(1), p)));
21+
return isMatch(s, p.substring(2)) || (firstMatch && isMatch(s.substring(1), p));
2222
} else {
2323
// Otherwise, check the next characters of both s and p.
2424
return firstMatch && isMatch(s.substring(1), p.substring(1));

0 commit comments

Comments
 (0)