deno.land / x / masx200_leetcode_test@10.6.5 / words-frequency-lcci / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
export default WordsFrequency;interface WordsFrequency { get(word: string): number;}function WordsFrequency(book: string[]): WordsFrequency { const storage = new Map<string, number>(); for (const word of book) { storage.set(word, 1 + (storage.get(word) ?? 0)); } function get(word: string): number { return storage.get(word) ?? 0; } return { get };}
masx200_leetcode_test

Version Info

Tagged at
a year ago