Trie DSA Problems

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 (Easy)
  2. Index Pairs of a String (Easy)
  3. Longest Common Prefix (Easy)
  4. Maximum Strong Pair XOR I (Easy)
  5. Add Bold Tag in String (Medium)
  6. Bold Words in String (Medium)
  7. Camelcase Matching (Medium)
  8. Design Add and Search Words Data Structure (Medium)
  9. Design File System (Medium)
  10. Extra Characters in a String (Medium)
  11. Find the Length of the Longest Common Prefix (Medium)
  12. Implement Magic Dictionary (Medium)
  13. Implement Trie (Prefix Tree) (Medium)
  14. Implement Trie II (Prefix Tree) (Medium)
  15. K Divisible Elements Subarrays (Medium)
  16. Lexicographical Numbers (Medium)
  17. Longest Word in Dictionary (Medium)
  18. Longest Word With All Prefixes (Medium)
  19. Map Sum Pairs (Medium)
  20. Maximum XOR of Two Numbers in an Array (Medium)
  21. Minimum Number of Valid Strings to Form Target I (Medium)
  22. Number of Distinct Substrings in a String (Medium)
  23. Number of Matching Subsequences (Medium)
  24. Partition String (Medium)
  25. Remove Sub-Folders from the Filesystem (Medium)
  26. Replace Words (Medium)
  27. Search Suggestions System (Medium)
  28. Short Encoding of Words (Medium)
  29. Shortest Uncommon Substring in an Array (Medium)
  30. Top K Frequent Words (Medium)
  31. Word Break (Medium)
  32. Words Within Two Edits of Dictionary (Medium)
  33. Concatenated Words (Hard)
  34. Count Pairs With XOR in a Range (Hard)
  35. Count Prefix and Suffix Pairs II (Hard)
  36. Delete Duplicate Folders in System (Hard)
  37. Design In-Memory File System (Hard)
  38. Design Search Autocomplete System (Hard)
  39. Distinct Echo Substrings (Hard)
  40. Encrypt and Decrypt Strings (Hard)
  41. K-th Smallest in Lexicographical Order (Hard)
  42. Longest Common Suffix Queries (Hard)
  43. Maximum Genetic Difference Query (Hard)
  44. Maximum Strong Pair XOR II (Hard)
  45. Maximum XOR of Two Non-Overlapping Subtrees (Hard)
  46. Maximum XOR With an Element From Array (Hard)
  47. Minimum Cost to Convert String II (Hard)
  48. Number of Valid Words for Each Puzzle (Hard)
  49. Palindrome Pairs (Hard)
  50. Prefix and Suffix Search (Hard)
  51. Stream of Characters (Hard)
  52. Sum of Prefix Scores of Strings (Hard)
  53. Word Abbreviation (Hard)
  54. Word Break II (Hard)
  55. Word Search II (Hard)
  56. Word Squares (Hard)

Companies that ask trie problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics