deno.land / x / masx200_leetcode_test@10.6.5 / implement-trie-ii-prefix-tree / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { TrieNode } from "./TrieNode.ts";import { TrieNodeCountWordsEqualTo } from "./TrieNodeCountWordsEqualTo.ts";import { TrieNodeCountWordsStartingWith } from "./TrieNodeCountWordsStartingWith.ts";import { TrieNodeErase } from "./TrieNodeErase.ts";import { TrieNodeInsert } from "./TrieNodeInsert.ts";
export default class Trie { insert(word: string): void { TrieNodeInsert(this.#root, word); } countWordsEqualTo(word: string): number { return TrieNodeCountWordsEqualTo(this.#root, word); } countWordsStartingWith(prefix: string): number { return TrieNodeCountWordsStartingWith(this.#root, prefix); } erase(word: string): void { TrieNodeErase(this.#root, word); } readonly #root = new TrieNode();}
masx200_leetcode_test

Version Info

Tagged at
2 years ago