Skip to content

Latest commit

 

History

History
6 lines (6 loc) · 274 Bytes

note0010.md

File metadata and controls

6 lines (6 loc) · 274 Bytes
  • dp[i][j], dp[0][0] = True
  • if s[i] == p[j]: dp[i][j] = dp[i-1][j-1]
  • if p[i] == ".": dp[i][j] = dp[i-1][j-1]
  • if p[i] == "*":
    • if p[j-1] != s[i]: dp[i][j] = dp[i][j-2]
    • if p[j-1] == s[i] or p[j-1] == ".": dp[i][j] = (dp[i]p[j-1] or dp[i-1][j] or dp[i][j-2])