44. Wildcard Matching

2020-08-09  本文已影响0人  xxxcoder

algo 1

dynamic programming + one dim vector

dp: dp[i][j] whether p^{'} with length j match current substring of {s^{'}} of length i

the transformation equations follows as:

p[j-1] != '*' dp[i-1][j-1] && (s[i - 1] == dp[j - 1] || dp[j - 1] == ? )

p[j-1] == '*' dp[i][j - 1] || dp[i - 1][j]

上一篇 下一篇

猜你喜欢

热点阅读