题库chevron_right分类chevron_right字典树
fork_right

字典树

45 道题目
简单: 3中等: 22困难: 20

字典树 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

题库

字典树 题库

先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。

慢加载专题题库

适合这类题很多的专题,先扫结构,再逐步深入。

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 45 道题目

每次续载 24 题
#题目难度
14

最长公共前缀

Find the longest common prefix in an array of strings, returning an empty string if none exists.

简单
139

单词拆分

Determine if a string can be fully segmented into dictionary words using array scanning and hash-based lookups for effic…

中等
140

单词拆分 II

Given a string and dictionary, return all possible sentences by adding spaces where each word is in the dictionary.

困难
208

实现 Trie (前缀树)

This problem requires designing a Trie (Prefix Tree) to efficiently store and query strings using hash table concepts fo…

中等
211

添加与搜索单词 - 数据结构设计

Build a WordDictionary supporting dynamic word addition and search with wildcard matching efficiently using Trie and DFS…

中等
212

单词搜索 II

Solve the Word Search II problem using backtracking with pruning to find all words on a board of characters.

困难
336

回文对

Find all pairs of words in a list that form palindromes when concatenated using efficient scanning and hash mapping.

困难
386

字典序排数

Generate all numbers from 1 to n in lexicographical order using a depth-first search pattern optimized with trie logic f…

中等
421

数组中两个数的最大异或值

Find the maximum XOR of two numbers in an integer array using efficient bit manipulation techniques.

中等
440

字典序的第K小数字

Find the k-th lexicographically smallest integer in a range using a Trie-based approach.

困难
472

连接词

Find concatenated words by using dynamic programming and depth-first search to identify valid words made of other words …

困难
648

单词替换

Replace words in a sentence using the shortest root from a dictionary, applying efficient array scanning and hash lookup…

中等
676

实现一个魔法字典

Design a Magic Dictionary to allow searching with one-character modifications, using Hash Table and String techniques.

中等
677

键值映射

Design and implement a data structure that supports efficient insertion and sum queries based on string prefixes.

中等
692

前K个高频单词

Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…

中等
720

词典中最长的单词

Find the longest word in a dictionary that can be built one character at a time from other words in the dictionary.

中等
745

前缀和后缀搜索

Design a dictionary to search words by both prefix and suffix using a Trie structure and hash lookups.

困难
792

匹配子序列的单词数

Given a string s and a list of words, count how many words are subsequences of s using efficient array scanning and hash…

中等
820

单词的压缩编码

Find the minimum length of a reference string encoding an array of words using array scanning and hash lookup efficientl…

中等
1023

驼峰式匹配

Camelcase Matching is a medium difficulty problem where you match queries to a given pattern by inserting lowercase lett…

中等
1032

字符流

Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…

困难
1178

猜字谜

Solve the "Number of Valid Words for Each Puzzle" problem with array scanning and hash lookup to efficiently count valid…

困难
1233

删除子文件夹

Remove sub-folders in a filesystem by filtering out folders nested inside other folders.

中等
1268

搜索推荐系统

Design a search suggestion system that provides the top three lexicographically smallest products matching a search word…

中等

swap_vert在题库框内继续向下滚动,也会自动续载

关联高频模式

LeetCode 字典树题型题解:45题训练路线