|
| 1 | +--- |
| 2 | +id: 02-Leetcode trie Practice Questions |
| 3 | +title: Leetcode trie Practice Questions |
| 4 | +sidebar_label: Leetcode trie Practice Questions |
| 5 | +tags: |
| 6 | + - dsa |
| 7 | + - data-structures |
| 8 | + - binary-tree |
| 9 | + - intermediate |
| 10 | + - javascript |
| 11 | + - python |
| 12 | + - c++ |
| 13 | + - java |
| 14 | + - programming |
| 15 | + - tutorial |
| 16 | +sidebar_position: 2 |
| 17 | +--- |
| 18 | + |
| 19 | +## Questions |
| 20 | + |
| 21 | +### 1. Implement Trie (Prefix Tree) |
| 22 | + |
| 23 | +**Problem:** Implement a trie with `insert`, `search`, and `startsWith` methods. |
| 24 | + |
| 25 | +**Link:** [Implement Trie (Prefix Tree)](https://leetcode.com/problems/implement-trie-prefix-tree/) |
| 26 | + |
| 27 | +### 2. Add and Search Word - Data structure design |
| 28 | + |
| 29 | +**Problem:** Design a data structure that supports adding new words and finding if a string matches any previously added string. |
| 30 | + |
| 31 | +**Link:** [Add and Search Word - Data structure design](https://leetcode.com/problems/add-and-search-word-data-structure-design/) |
| 32 | + |
| 33 | +### 3. Longest Word in Dictionary |
| 34 | + |
| 35 | +**Problem:** Find the longest word in the dictionary that can be built one character at a time by other words in the dictionary. |
| 36 | + |
| 37 | +**Link:** [Longest Word in Dictionary](https://leetcode.com/problems/longest-word-in-dictionary/) |
| 38 | + |
| 39 | +### 4. Replace Words |
| 40 | + |
| 41 | +**Problem:** Implement a function to replace all words in a sentence with their root forms using a dictionary of roots. |
| 42 | + |
| 43 | +**Link:** [Replace Words](https://leetcode.com/problems/replace-words/) |
| 44 | + |
| 45 | +### 5. Stream of Characters |
| 46 | + |
| 47 | +**Problem:** Design a class to search for strings in a stream of characters. |
| 48 | + |
| 49 | +**Link:** [Stream of Characters](https://leetcode.com/problems/stream-of-characters/) |
| 50 | + |
| 51 | +### 6. Design Search Autocomplete System |
| 52 | + |
| 53 | +**Problem:** Implement a search autocomplete system that supports inputting characters and returning the top 3 historical hot sentences. |
| 54 | + |
| 55 | +**Link:** [Design Search Autocomplete System](https://leetcode.com/problems/design-search-autocomplete-system/) |
| 56 | + |
| 57 | +### 7. Prefix and Suffix Search |
| 58 | + |
| 59 | +**Problem:** Design a class that supports querying words with given prefix and suffix. |
| 60 | + |
| 61 | +**Link:** [Prefix and Suffix Search](https://leetcode.com/problems/prefix-and-suffix-search/) |
| 62 | + |
| 63 | +### 8. Word Search II |
| 64 | + |
| 65 | +**Problem:** Given a 2D board and a list of words, find all words that can be formed by letters of the board. |
| 66 | + |
| 67 | +**Link:** [Word Search II](https://leetcode.com/problems/word-search-ii/) |
| 68 | + |
| 69 | +### 9. Map Sum Pairs |
| 70 | + |
| 71 | +**Problem:** Implement a MapSum class with insert and sum methods, which sum all keys with a given prefix. |
| 72 | + |
| 73 | +**Link:** [Map Sum Pairs](https://leetcode.com/problems/map-sum-pairs/) |
| 74 | + |
| 75 | +### 10. Design Add and Search Words Data Structure |
| 76 | + |
| 77 | +**Problem:** Design a data structure that supports adding new words and finding if a string matches any previously added string, with support for wildcards. |
| 78 | + |
| 79 | +**Link:** [Design Add and Search Words Data Structure](https://leetcode.com/problems/design-add-and-search-words-data-structure/) |
| 80 | + |
| 81 | +### 11. Palindrome Pairs |
| 82 | + |
| 83 | +**Problem:** Given a list of unique words, find all pairs of distinct indices (i, j) such that the concatenation of words[i] and words[j] is a palindrome. |
| 84 | + |
| 85 | +**Link:** [Palindrome Pairs](https://leetcode.com/problems/palindrome-pairs/) |
| 86 | + |
| 87 | +### 12. Maximum XOR of Two Numbers in an Array |
| 88 | + |
| 89 | +**Problem:** Find the maximum XOR of two numbers in an array. |
| 90 | + |
| 91 | +**Link:** [Maximum XOR of Two Numbers in an Array](https://leetcode.com/problems/maximum-xor-of-two-numbers-in-an-array/) |
| 92 | + |
| 93 | +### 13. Concatenated Words |
| 94 | + |
| 95 | +**Problem:** Find all concatenated words in a given dictionary of words. |
| 96 | + |
| 97 | +**Link:** [Concatenated Words](https://leetcode.com/problems/concatenated-words/) |
| 98 | + |
| 99 | +### 14. Design Phone Directory |
| 100 | + |
| 101 | +**Problem:** Design a phone directory that initially has all phone numbers available to be assigned and supports checking availability, getting a number, and releasing a number. |
| 102 | + |
| 103 | +**Link:** [Design Phone Directory](https://leetcode.com/problems/design-phone-directory/) |
| 104 | + |
| 105 | +### 15. Search Suggestions System |
| 106 | + |
| 107 | +**Problem:** Given an array of products and a search word, design a system that suggests at most 3 products as you type each character of the search word. |
| 108 | + |
| 109 | +**Link:** [Search Suggestions System](https://leetcode.com/problems/search-suggestions-system/) |
| 110 | + |
| 111 | +### 16. Word Filter |
| 112 | + |
| 113 | +**Problem:** Implement a WordFilter class that supports searching for words with a given prefix and suffix. |
| 114 | + |
| 115 | +**Link:** [Word Filter](https://leetcode.com/problems/word-filter/) |
| 116 | + |
| 117 | +### 17. Index Pairs of a String |
| 118 | + |
| 119 | +**Problem:** Given a string text and an array of words, return all index pairs [i, j] so that the substring text[i...j] is in the array of words. |
| 120 | + |
| 121 | +**Link:** [Index Pairs of a String](https://leetcode.com/problems/index-pairs-of-a-string/) |
| 122 | + |
| 123 | +### 18. Camelcase Matching |
| 124 | + |
| 125 | +**Problem:** Given a list of queries and a pattern, return a list of booleans where each boolean indicates whether the query matches the pattern. |
| 126 | + |
| 127 | +**Link:** [Camelcase Matching](https://leetcode.com/problems/camelcase-matching/) |
| 128 | + |
| 129 | +### 19. Prefix and Suffix Search |
| 130 | + |
| 131 | +**Problem:** Implement a class that supports querying words with a given prefix and suffix (similar to question 7 but can be a different version or extension). |
| 132 | + |
| 133 | +**Link:** [Prefix and Suffix Search](https://leetcode.com/problems/prefix-and-suffix-search/) |
| 134 | + |
| 135 | +### 20. Delete Duplicate Folders in System |
| 136 | + |
| 137 | +**Problem:** Given a system of folders, delete all duplicate folders and return the list of unique folders. |
| 138 | + |
| 139 | +**Link:** [Delete Duplicate Folders in System](https://leetcode.com/problems/delete-duplicate-folders-in-system/) |
0 commit comments