Skip to content

Commit

Permalink
Update wildcard-matching.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Jan 29, 2015
1 parent 41b185d commit 7d880f9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Python/wildcard-matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def isMatch(self, s, p):

return p_ptr == len(p)

# dp
# dp with rolling window
# Time: O(m * n)
# Space: O(m + n)
class Solution2:
# @return a boolean
def isMatch(self, s, p):
Expand Down Expand Up @@ -120,4 +122,4 @@ def isMatch(self, s, p):
print Solution().isMatch("aa", "a*")
print Solution().isMatch("aa", "?*")
print Solution().isMatch("ab", "?*")
print Solution().isMatch("aab", "c*a*b")
print Solution().isMatch("aab", "c*a*b")

0 comments on commit 7d880f9

Please sign in to comment.