Fix ruff formatting in if statements

This commit is contained in:
Amir Hosseini 2023-08-14 08:13:58 +03:30 committed by GitHub
parent 7271e3d2a5
commit 4456366da0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,11 +82,11 @@ def dp_match(text: str, pattern: str) -> bool:
for i in range(1, m + 1):
for j in range(1, n + 1):
if pattern[j - 1] == "." or pattern[j - 1] == text[i - 1]:
if pattern[j - 1] in {".", text[i - 1]}:
dp[i][j] = dp[i - 1][j - 1]
elif pattern[j - 1] == "*":
dp[i][j] = dp[i][j - 2]
if pattern[j - 2] == "." or pattern[j - 2] == text[i - 1]:
if pattern[j - 2] in {".", text[i - 1]}:
dp[i][j] |= dp[i - 1][j]
else:
dp[i][j] = False