File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,12 @@ class TrieNode {
55 /**
66 * An object that stores child nodes for each character in the alphabet.
77 */
8- children : { [ key : string ] : TrieNode } = { }
8+ children : Record < string , TrieNode > = { }
99
1010 /**
1111 * Indicates whether the node represents the end of a word.
1212 */
13- isWord : boolean = false
13+ isWord = false
1414}
1515
1616/**
@@ -22,11 +22,6 @@ export class Trie {
2222 */
2323 root : TrieNode = new TrieNode ( )
2424
25- /**
26- * Creates a new Trie instance.
27- */
28- constructor ( ) { }
29-
3025 /**
3126 * Inserts a word into the Trie.
3227 *
@@ -51,7 +46,7 @@ export class Trie {
5146 * If false, the method returns true only if an exact match is found.
5247 * @returns True if the word (or prefix) is found in the Trie; otherwise, false.
5348 */
54- public find ( word : string , isPrefixMatch : boolean = false ) : boolean {
49+ public find ( word : string , isPrefixMatch = false ) : boolean {
5550 return this . searchNode ( this . root , word , isPrefixMatch )
5651 }
5752
You can’t perform that action at this time.
0 commit comments