# Trie DSA Problems

> 56 Trie coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/trie
Last updated: 2026-11-28

56 trie problems for coding interviews and campus placements, with hints and company tags. Below are all 56: 4 easy, 28 medium and 24 hard. Practise them free on InternHack and track what you have solved.

## Trie problems, easiest first

1. [Count Prefix and Suffix Pairs I](https://www.internhack.in/learn/dsa/problem/count-prefix-and-suffix-pairs-i) (Easy)
2. [Index Pairs of a String](https://www.internhack.in/learn/dsa/problem/index-pairs-of-a-string) (Easy)
3. [Longest Common Prefix](https://www.internhack.in/learn/dsa/problem/longest-common-prefix) (Easy)
4. [Maximum Strong Pair XOR I](https://www.internhack.in/learn/dsa/problem/maximum-strong-pair-xor-i) (Easy)
5. [Add Bold Tag in String](https://www.internhack.in/learn/dsa/problem/add-bold-tag-in-string) (Medium)
6. [Bold Words in String](https://www.internhack.in/learn/dsa/problem/bold-words-in-string) (Medium)
7. [Camelcase Matching](https://www.internhack.in/learn/dsa/problem/camelcase-matching) (Medium)
8. [Design Add and Search Words Data Structure](https://www.internhack.in/learn/dsa/problem/design-add-and-search-words-data-structure) (Medium)
9. [Design File System](https://www.internhack.in/learn/dsa/problem/design-file-system) (Medium)
10. [Extra Characters in a String](https://www.internhack.in/learn/dsa/problem/extra-characters-in-a-string) (Medium)
11. [Find the Length of the Longest Common Prefix](https://www.internhack.in/learn/dsa/problem/find-the-length-of-the-longest-common-prefix) (Medium)
12. [Implement Magic Dictionary](https://www.internhack.in/learn/dsa/problem/implement-magic-dictionary) (Medium)
13. [Implement Trie (Prefix Tree)](https://www.internhack.in/learn/dsa/problem/implement-trie-prefix-tree) (Medium)
14. [Implement Trie II (Prefix Tree)](https://www.internhack.in/learn/dsa/problem/implement-trie-ii-prefix-tree) (Medium)
15. [K Divisible Elements Subarrays](https://www.internhack.in/learn/dsa/problem/k-divisible-elements-subarrays) (Medium)
16. [Lexicographical Numbers](https://www.internhack.in/learn/dsa/problem/lexicographical-numbers) (Medium)
17. [Longest Word in Dictionary](https://www.internhack.in/learn/dsa/problem/longest-word-in-dictionary) (Medium)
18. [Longest Word With All Prefixes](https://www.internhack.in/learn/dsa/problem/longest-word-with-all-prefixes) (Medium)
19. [Map Sum Pairs](https://www.internhack.in/learn/dsa/problem/map-sum-pairs) (Medium)
20. [Maximum XOR of Two Numbers in an Array](https://www.internhack.in/learn/dsa/problem/maximum-xor-of-two-numbers-in-an-array) (Medium)
21. [Minimum Number of Valid Strings to Form Target I](https://www.internhack.in/learn/dsa/problem/minimum-number-of-valid-strings-to-form-target-i) (Medium)
22. [Number of Distinct Substrings in a String](https://www.internhack.in/learn/dsa/problem/number-of-distinct-substrings-in-a-string) (Medium)
23. [Number of Matching Subsequences](https://www.internhack.in/learn/dsa/problem/number-of-matching-subsequences) (Medium)
24. [Partition String](https://www.internhack.in/learn/dsa/problem/partition-string) (Medium)
25. [Remove Sub-Folders from the Filesystem](https://www.internhack.in/learn/dsa/problem/remove-sub-folders-from-the-filesystem) (Medium)
26. [Replace Words](https://www.internhack.in/learn/dsa/problem/replace-words) (Medium)
27. [Search Suggestions System](https://www.internhack.in/learn/dsa/problem/search-suggestions-system) (Medium)
28. [Short Encoding of Words](https://www.internhack.in/learn/dsa/problem/short-encoding-of-words) (Medium)
29. [Shortest Uncommon Substring in an Array](https://www.internhack.in/learn/dsa/problem/shortest-uncommon-substring-in-an-array) (Medium)
30. [Top K Frequent Words](https://www.internhack.in/learn/dsa/problem/top-k-frequent-words) (Medium)
31. [Word Break](https://www.internhack.in/learn/dsa/problem/word-break) (Medium)
32. [Words Within Two Edits of Dictionary](https://www.internhack.in/learn/dsa/problem/words-within-two-edits-of-dictionary) (Medium)
33. [Concatenated Words](https://www.internhack.in/learn/dsa/problem/concatenated-words) (Hard)
34. [Count Pairs With XOR in a Range](https://www.internhack.in/learn/dsa/problem/count-pairs-with-xor-in-a-range) (Hard)
35. [Count Prefix and Suffix Pairs II](https://www.internhack.in/learn/dsa/problem/count-prefix-and-suffix-pairs-ii) (Hard)
36. [Delete Duplicate Folders in System](https://www.internhack.in/learn/dsa/problem/delete-duplicate-folders-in-system) (Hard)
37. [Design In-Memory File System](https://www.internhack.in/learn/dsa/problem/design-in-memory-file-system) (Hard)
38. [Design Search Autocomplete System](https://www.internhack.in/learn/dsa/problem/design-search-autocomplete-system) (Hard)
39. [Distinct Echo Substrings](https://www.internhack.in/learn/dsa/problem/distinct-echo-substrings) (Hard)
40. [Encrypt and Decrypt Strings](https://www.internhack.in/learn/dsa/problem/encrypt-and-decrypt-strings) (Hard)
41. [K-th Smallest in Lexicographical Order](https://www.internhack.in/learn/dsa/problem/k-th-smallest-in-lexicographical-order) (Hard)
42. [Longest Common Suffix Queries](https://www.internhack.in/learn/dsa/problem/longest-common-suffix-queries) (Hard)
43. [Maximum Genetic Difference Query](https://www.internhack.in/learn/dsa/problem/maximum-genetic-difference-query) (Hard)
44. [Maximum Strong Pair XOR II](https://www.internhack.in/learn/dsa/problem/maximum-strong-pair-xor-ii) (Hard)
45. [Maximum XOR of Two Non-Overlapping Subtrees](https://www.internhack.in/learn/dsa/problem/maximum-xor-of-two-non-overlapping-subtrees) (Hard)
46. [Maximum XOR With an Element From Array](https://www.internhack.in/learn/dsa/problem/maximum-xor-with-an-element-from-array) (Hard)
47. [Minimum Cost to Convert String II](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-convert-string-ii) (Hard)
48. [Number of Valid Words for Each Puzzle](https://www.internhack.in/learn/dsa/problem/number-of-valid-words-for-each-puzzle) (Hard)
49. [Palindrome Pairs](https://www.internhack.in/learn/dsa/problem/palindrome-pairs) (Hard)
50. [Prefix and Suffix Search](https://www.internhack.in/learn/dsa/problem/prefix-and-suffix-search) (Hard)
51. [Stream of Characters](https://www.internhack.in/learn/dsa/problem/stream-of-characters) (Hard)
52. [Sum of Prefix Scores of Strings](https://www.internhack.in/learn/dsa/problem/sum-of-prefix-scores-of-strings) (Hard)
53. [Word Abbreviation](https://www.internhack.in/learn/dsa/problem/word-abbreviation) (Hard)
54. [Word Break II](https://www.internhack.in/learn/dsa/problem/word-break-ii) (Hard)
55. [Word Search II](https://www.internhack.in/learn/dsa/problem/word-search-ii) (Hard)
56. [Word Squares](https://www.internhack.in/learn/dsa/problem/word-squares) (Hard)

## Companies that ask trie problems

- [Google](https://www.internhack.in/learn/dsa/companies/google): 41 of these problems
- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 31 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 25 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 23 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 19 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 15 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 15 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 11 of these problems
- [Oracle](https://www.internhack.in/learn/dsa/companies/oracle): 10 of these problems
- [Doordash](https://www.internhack.in/learn/dsa/companies/doordash): 7 of these problems
- [Snowflake](https://www.internhack.in/learn/dsa/companies/snowflake): 7 of these problems
- [Goldman Sachs](https://www.internhack.in/learn/dsa/companies/goldman-sachs): 5 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
