LeetCode Trie常见的题型以及要注意的点

LeetCode: Word Squares
LeetCode: Word Search II
LeetCode: Stream of Characters
LeetCode: Short Encoding of Words
LeetCode: Replace Words
LeetCode: Remove Sub-Folders from the Filesystem
LeetCode: Prefix and Suffix Search
LeetCode: Maximum XOR of Two Numbers in an Array
LeetCode: Map Sum Pairs
LeetCode: Longest Word in Dictionary
LeetCode: Implement Trie (Prefix Tree)
LeetCode: Implement Magic Dictionary
LeetCode: Add and Search Word – Data structure design

Trie可以解决哪些抽象问题呢?
Count of distinct substrings of a string (计算String里面有多少独一无二的substrings)
Generate all unique substrings for given string (输出所有独一无二的substrings)
Finding the longest repeated substring (找出最长的有重复的substring)
Finding the longest common substring (找出LCS)
Finding the longest palindrome in a string (找出最长的palindrome)
(其实除了第二个 其他的都像是DP问题 但是Trie可能解决输出结果而不是长度的问题)

Trie都有哪些要注意的点:
常见的trie的operations: insert/search/startsWith

Trie常见的用处:
fuzzy matching
live data stream
遇到这两个东西要能想起来可以用trie来处理。

posted @ 2020-12-14 03:15  EvanMeetTheWorld  阅读(22)  评论(0)    收藏  举报