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.
1 parent 702293a commit 8e1bac5Copy full SHA for 8e1bac5
src/main/kotlin/g0001_0100/s0010_regular_expression_matching/Solution.kt
@@ -6,7 +6,7 @@ class Solution {
6
dp[text.length][pattern.length] = true
7
for (i in text.length downTo 0) {
8
for (j in pattern.length - 1 downTo 0) {
9
- val firstMatch = i < text.length && ((pattern[j] == text[i] || pattern[j] == '.'))
+ val firstMatch = i < text.length && (pattern[j] == text[i] || pattern[j] == '.')
10
if (j + 1 < pattern.length && pattern[j + 1] == '*') {
11
dp[i][j] = dp[i][j + 2] || firstMatch && dp[i + 1][j]
12
} else {
0 commit comments