Last active
March 4, 2020 18:02
-
-
Save deque-blog/99d51aef91e838bfff56974724c43a5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@classmethod | |
def compile(cls, pattern: str): | |
nodes = [] | |
stars = [] | |
for c in pattern: | |
if c == "*": | |
stars[-1] = True | |
else: | |
nodes.append(c) | |
stars.append(False) | |
return cls(nodes=nodes, stars=stars) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment