![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字典树
MD_
不拼一下 你怎么知道你不会成功!
展开
-
Leetcode 208. 实现Trie(前缀树)
文章目录问题描述解题报告实现代码参考资料 问题描述 实现一个 Trie (前缀树),包含 insert, search, 和 startsWith 这三个操作。 示例: Trie trie = new Trie(); trie.insert(“apple”); trie.search(“apple”); // 返回 true trie.search(“app”); // 返回 false trie.startsWith(“app”); // 返回 true trie.insert(“app”);原创 2020-09-05 09:38:03 · 212 阅读 · 0 评论 -
Leetcode 820. 单词的压缩编码
文章目录问题描述解题报告实现代码 问题描述 给定一个单词列表,我们将这个列表编码成一个索引字符串 S 与一个索引列表 A。 例如,如果这个列表是 ["time", "me", "bell"],我们就可以将其表示为 S = "time#bell#" 和 indexes = [0, 2, 5]。 对于每一个索引,我们可以通过从字符串 S 中索引的位置开始读取字符串,直到 "#" 结束,来恢复我们之前的...转载 2020-03-28 16:24:30 · 69 阅读 · 0 评论