File tree 1 file changed +3
-8
lines changed
1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,12 @@ class TrieNode {
5
5
/**
6
6
* An object that stores child nodes for each character in the alphabet.
7
7
*/
8
- children : { [ key : string ] : TrieNode } = { }
8
+ children : Record < string , TrieNode > = { }
9
9
10
10
/**
11
11
* Indicates whether the node represents the end of a word.
12
12
*/
13
- isWord : boolean = false
13
+ isWord = false
14
14
}
15
15
16
16
/**
@@ -22,11 +22,6 @@ export class Trie {
22
22
*/
23
23
root : TrieNode = new TrieNode ( )
24
24
25
- /**
26
- * Creates a new Trie instance.
27
- */
28
- constructor ( ) { }
29
-
30
25
/**
31
26
* Inserts a word into the Trie.
32
27
*
@@ -51,7 +46,7 @@ export class Trie {
51
46
* If false, the method returns true only if an exact match is found.
52
47
* @returns True if the word (or prefix) is found in the Trie; otherwise, false.
53
48
*/
54
- public find ( word : string , isPrefixMatch : boolean = false ) : boolean {
49
+ public find ( word : string , isPrefixMatch = false ) : boolean {
55
50
return this . searchNode ( this . root , word , isPrefixMatch )
56
51
}
57
52
You can’t perform that action at this time.
0 commit comments