Logo
TGCATALOG
Catalog Collections Blog
JavaScript | LeetCode

JavaScript | LeetCode

LeetCode tasks and solutions in JavaScript. Ideal for interview preparation and improving algorithm skills.

No ratings
385
01.12.2026
385
01.12.2026
No ratings
385
01.12.2026
Safe redirect via bot
О канале

LeetCode tasks and solutions in JavaScript. Ideal for interview preparation and improving algorithm skills.

Подписчиков —
Тематика Technology
Ссылка @easy_frontend_task

We also recommend

Kekaton AI | Voiceover and voice clone
Kekaton AI | Voiceover and voice clone
Bot

AI bot for text-to-speech and voice cloning in Telegram. Create audio using neural network quickly and easily.

Description

The channel is dedicated to solving LeetCode tasks in JavaScript. It contains code examples for popular algorithmic problems frequently encountered in interviews. The materials will help master data structures, sorting, dynamic programming, and other key topics. Suitable for junior and middle developers looking to improve their skills.

Latest posts

JavaScript | LeetCode
JavaScript | LeetCode
🔒Открыть пост
и посмотреть медиа
Задача: 288. Unique Word Abbreviation Сложность: medium Сокращение слова — это объединение его первой буквы, количества символов между первой и последней буквой и последней буквы. Если слово состоит только из двух символов, то оно является сокращением само по себе. Например: dog --> d1g, потому что между первой буквой 'd' и последней буквой 'g' одна буква. internationalization --> i18n, потому что между первой буквой 'i' и последней буквой 'n' 18 букв. it --> it, потому что любое слово из двух символов является своим собственным сокращением. Реализуйте класс ValidWordAbbr: ValidWordAbbr(String[] dictionary) Инициализирует объект со словарем слов. boolean isUnique(string word) Возвращает true, если выполняется одно из следующих условий (в противном случае возвращает false): В словаре нет слова, сокращение которого равно сокращению слова word. Для любого слова в словаре, сокращение которого равно сокращению слова word, это слово и word одинаковы. Пример: Input ["ValidWordAbbr", "isUnique", "isUnique", "isUnique", "isUnique", "isUnique"] [[["deer", "door", "cake", "card"]], ["dear"], ["cart"], ["cane"], ["make"], ["cake"]] Output [null, false, true, false, true, true] Explanation ValidWordAbbr validWordAbbr = new ValidWordAbbr(["deer", "door", "cake", "card"]); validWordAbbr.isUnique("dear"); // return false, dictionary word "deer" and word "dear" have the same abbreviation "d2r" but are not the same. validWordAbbr.isUnique("cart"); // return true, no words in the dictionary have the abbreviation "c2t". validWordAbbr.isUnique("cane"); // return false, dictionary word "cake" and word "cane" have the same abbreviation "c2e" but are not the same. validWordAbbr.isUnique("make"); // return true, no words in the dictionary have the abbreviation "m2e". validWordAbbr.isUnique("cake"); // return true, because "cake" is already in the dictionary and no other word in the dictionary has "c2e" abbreviation. 👨💻 Алгоритм: 1⃣Инициализация: Создайте словарь сокращений abbrDict, который будет хранить сокращения слов в виде ключей и булевы значения, указывающие, уникально ли сокращение. Создайте множество dict, содержащее все слова из словаря, чтобы быстро проверять наличие слова в словаре. 2⃣Генерация сокращений: При инициализации объекта ValidWordAbbr пройдите через каждое слово в словаре и создайте его сокращение. Если сокращение уже существует в abbrDict, установите значение в false (не уникальное). В противном случае установите значение в true (уникальное). 3⃣Проверка уникальности: Для метода isUnique создайте сокращение для входного слова и проверьте, есть ли это сокращение в abbrDict. Если сокращение отсутствует в abbrDict, возвращайте true. Если сокращение присутствует и оно уникально, проверьте, есть ли это слово в словаре. Если да, возвращайте true, в противном случае - false. 😎 Решение: class ValidWordAbbr { constructor(dictionary) { this.abbrDict = new Map(); this.dict = new Set(dictionary); for (const word of this.dict) { const abbr = this.toAbbr(word); this.abbrDict.set(abbr, !this.abbrDict.get(abbr)); } } isUnique(word) { const abbr = this.toAbbr(word); const hasAbbr = this.abbrDict.get(abbr); return hasAbbr === undefined || (hasAbbr && this.dict.has(word)); } toAbbr(word) { const n = word.length; if (n
JavaScript | LeetCode
FAQ

Open JavaScript | LeetCode in Telegram and press the Start button. No separate registration is required.

Yes. The service is designed to be straightforward: open the resource, follow the on-screen instructions and start using it.

No. You can use JavaScript | LeetCode directly in Telegram unless the resource description says otherwise.

Access depends on the resource. Check the current information in Telegram after opening JavaScript | LeetCode.

The exact features depend on the resource. Open JavaScript | LeetCode to see its current functions, content and access conditions.

Reviews for channel JavaScript | LeetCode

Log in to leave a review

Only registered users can share their opinion.

No reviews yet

Be the first to share your impression of this resource!

Similar resources

Loading
Switch to Light Theme
Home Catalog Collections Blog Login