MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / StartsWith

Method StartsWith

implement_trie_208/solution.go:47–49  ·  view source on GitHub ↗

Returns true if there is any word in the trie that starts with the given prefix

(prefix string)

Source from the content-addressed store, hash-verified

45
46// Returns true if there is any word in the trie that starts with the given prefix
47func (this *Trie) StartsWith(prefix string) bool {
48 return this.search(prefix, false)
49}
50
51func (this *Trie) search(word string, needsEnd bool) bool {
52 curr := this.root

Callers 1

TestTrieFunction · 0.80

Calls 1

searchMethod · 0.95

Tested by 1

TestTrieFunction · 0.64