Ruby's Louvre

每天学习一点点算法

导航

2019年12月28日 #

leetcode 720. Longest Word in Dictionary

摘要: 使用前缀树 javascript function Node() { this.word = '' this.children = {} } class Trie { constructor() { this.root = new Node() } addWord(word) { var node 阅读全文

posted @ 2019-12-28 22:35 司徒正美 阅读(460) 评论(0) 推荐(0) 编辑

leetcode 692. Top K Frequent Words

摘要: ```javascript function Node() { this.endCount = 0 this.word = '' this.children = {} } class Tire { constructor() { this.root = new Node() } addWord... 阅读全文

posted @ 2019-12-28 22:01 司徒正美 阅读(518) 评论(0) 推荐(0) 编辑

leetcode 677. Map Sum Pairs

摘要: 使用前缀树 或者 使用map优化一下 阅读全文

posted @ 2019-12-28 20:12 司徒正美 阅读(389) 评论(0) 推荐(0) 编辑

leetcode 676. Implement Magic Dictionary

摘要: 使用Tire 处理 javascript function Node(value) { this.word = null this.children = {} } class MagicDictionary { constructor() { this.root = new Node(null) } 阅读全文

posted @ 2019-12-28 00:17 司徒正美 阅读(374) 评论(0) 推荐(0) 编辑