MCPcopy Index your code
hub / github.com/neetcode-gh/leetcode / startsWith

Method startsWith

javascript/0208-implement-trie-prefix-tree.js:48–58  ·  view source on GitHub ↗
(prefix, node = this.root)

Source from the content-addressed store, hash-verified

46
47 /* Time O(N) | Space O(1) */
48 startsWith(prefix, node = this.root) {
49 for (const char of prefix) {
50 const child = node.children[char] || null;
51
52 if (!child) return false;
53
54 node = child;
55 }
56
57 return true;
58 }
59}

Callers 1

canBuildGraphFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected