From b428e1c67943fc0a8564b9a74f8b1f2b2ee161a9 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Mon, 7 Oct 2024 17:26:15 +0800 Subject: [PATCH] update --- src/wildcard_match/wildcard_match.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wildcard_match/wildcard_match.cpp b/src/wildcard_match/wildcard_match.cpp index a19012a..2d344a3 100644 --- a/src/wildcard_match/wildcard_match.cpp +++ b/src/wildcard_match/wildcard_match.cpp @@ -14,6 +14,13 @@ int main(){ dp[0][0] = true; + for(const size_t j:range((size_t)1,p.size())){ + const auto get_p = [](const size_t n)->char{return p[n-1];}; + if(get_p(j)=='*'){ + dp[0][j] = dp[0][j-1]; + } + } + for(const size_t i:range((size_t)1,s.size()+1)){ for(const size_t j:range((size_t)1,p.size()+1)){ const auto get_p = [](const size_t n)->char{return p[n-1];};