随笔分类 -  Trie Tree

摘要:Design a search autocomplete system for a search engine. Users may input a sentence (at least one word and end with a special character '#'). You are 阅读全文
posted @ 2021-08-30 03:40 苗妙苗 阅读(29) 评论(0) 推荐(0)
摘要:[抄题]: 给出一个由小写字母组成的矩阵和一个字典。找出所有同时在字典和矩阵中出现的单词。一个单词可以从矩阵中的任意位置开始,可以向左/右/上/下四个相邻方向移动。 给出矩阵: 和字典: 返回 {"dog", "dad", "can", "again"} [暴力解法]: 时间分析: 空间分析: [思 阅读全文
posted @ 2018-02-26 08:49 苗妙苗 阅读(208) 评论(0) 推荐(0)
摘要:[抄题]: Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. [暴力解法]: 阅读全文
posted @ 2018-02-25 22:43 苗妙苗 阅读(290) 评论(0) 推荐(0)