From 4456366da0c3ca3e94eb0a2574c32977bc21a0ce Mon Sep 17 00:00:00 2001 From: Amir Hosseini <19665344+itsamirhn@users.noreply.github.com> Date: Mon, 14 Aug 2023 08:13:58 +0330 Subject: [PATCH] Fix ruff formatting in if statements --- dynamic_programming/regex_match.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynamic_programming/regex_match.py b/dynamic_programming/regex_match.py index 6e5a3805a..c1c3326f6 100644 --- a/dynamic_programming/regex_match.py +++ b/dynamic_programming/regex_match.py @@ -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