摘要: Python版本 class Trie: def __init__(self): self.children = defaultdict(Trie) self.word = "" self.is_word = False def insert(self, word): cur = self for 阅读全文
posted @ 2022-08-20 17:10 Notomato 阅读(32) 评论(0) 推荐(0)
摘要: Python版本 class UF: parent = {} size = {} cnt = 0 def __init__(self, M): # 初始化 parent,size 和 cnt # self.parent = {i for i in range(n)} def find(self, x 阅读全文
posted @ 2022-08-20 17:08 Notomato 阅读(22) 评论(0) 推荐(0)