Back to DSA sheet

Implement Trie (Prefix Tree)

MediumTries
Open on LeetCodeAmazonGoogleMicrosoft

Implement a trie supporting insert, search for a full word, and startsWith for a prefix.

Constraints
  • 1 <= word.length <= 2000
  • Lowercase English letters
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250
implement-trie-prefix-tree.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.