Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a Trie data structure to support efficient insertion and lookup of words.

Hard

Problem Statement

Create a Trie data structure to support efficient insertion and lookup of words.

Sample Input

Insert("go"); Search("go")

Sample Output

true

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
package main import "fmt" type Trie struct { // Your code here } func NewTrie() *Trie { return &Trie{} } func main() { trie := NewTrie() trie.Insert("go") fmt.Println(trie.Search("go")) // Expected Output: true fmt.Println(trie.Search("golang")) // Expected Output: false }
Log in or sign up to run or submit your code.Log inSign up
Input
Insert("go"); Search("go")
Expected Output
true