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
389
02.12.2026
389
02.12.2026
No ratings
389
02.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
🔒Открыть пост
и посмотреть медиа
Задача: 672. Bulb Switcher II Сложность: medium Есть комната с n лампочками, пронумерованными от 1 до n, которые изначально все включены, и четыре кнопки на стене. Каждая из четырех кнопок имеет разную функциональность: Кнопка 1: Переключает состояние всех лампочек. Кнопка 2: Переключает состояние всех лампочек с четными номерами (т.е. 2, 4, ...). Кнопка 3: Переключает состояние всех лампочек с нечетными номерами (т.е. 1, 3, ...). Кнопка 4: Переключает состояние всех лампочек с номером j = 3k + 1, где k = 0, 1, 2, ... (т.е. 1, 4, 7, 10, ...). Необходимо сделать ровно presses нажатий кнопок. Для каждого нажатия можно выбрать любую из четырех кнопок для нажатия. Даны два целых числа n и presses, вернуть количество различных возможных состояний после выполнения всех presses нажатий кнопок. Пример: Input: n = 1, presses = 1 Output: 2 Explanation: Status can be: - [off] by pressing button 1 - [on] by pressing button 2 👨💻 Алгоритм: 1⃣Рассчитаем возможные множества остатков: то есть какие множества c_i = f_i (mod 2) возможны. 2⃣Так как c_i ≡ f_i и c_i ≤ f_i, если ∑f_i ≠ ∑c_i, или если ∑f_i < ∑c_i, это невозможно. В противном случае это возможно простым построением: выполните операции, указанные c_i, затем выполните операцию номер 1 с четным числом оставшихся операций. 3⃣Для каждого возможного множества остатков симулируем и запоминаем, как будут выглядеть первые 6 лампочек, сохраняя это в структуре Set. В конце возвращаем размер этого множества. 😎 Решение: var flipLights = function(n, m) { let seen = new Set(); n = Math.min(n, 6); let shift = Math.max(0, 6 - n); for (let cand = 0; cand < 16; ++cand) { let bcount = cand.toString(2).split('1').length - 1; if (bcount % 2 == m % 2 && bcount > 0) & 1) lights ^= 0b111111 >> shift; if ((cand >> 1) & 1) lights ^= 0b010101 >> shift; if ((cand >> 2) & 1) lights ^= 0b101010 >> shift; if ((cand >> 3) & 1) lights ^= 0b100100 >> shift; seen.add(lights); } } return seen.size; } Ставь 👍 и забирай 📚 Базу знаний
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