Skip to content

Instantly share code, notes, and snippets.

View changzhongzhong's full-sized avatar
💭
I may be slow to respond.

changzhongzhong changzhongzhong

💭
I may be slow to respond.
View GitHub Profile
class PyTrieNode(object):
def __init__(self, key="", seq=[]):
self.key = key
self.end = len(seq) == 0
self.children = {}
if len(seq) > 0:
self.children[seq[0]] = PyTrieNode(seq[0], seq[1:])
def add(self, seq):
if len(seq) == 0: