Logo
TGCATALOG
Catalog Collections Blog
C# LeetCode - tasks

C# LeetCode - tasks

LeetCode C#.

No ratings
622
31.10.2026
622
31.10.2026
No ratings
622
31.10.2026
Safe redirect via bot
О канале

LeetCode C#.

Подписчиков 3,158
Тематика Technology
Язык English
Ссылка t.me/easy_c_sharp_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

LeetCode tasks in C#.

Latest posts

C# LeetCode - tasks
C# LeetCode - tasks
🔒Открыть пост
и посмотреть медиа
Задача: 811. Subdomain Visit Count Сложность: medium Веб-сайт с доменом "discuss.leetcode.com" состоит из различных поддоменов. На верхнем уровне у нас есть "com", на следующем уровне - "leetcode.com", и на самом нижнем уровне - "discuss.leetcode.com". Когда мы посещаем домен, такой как "discuss.leetcode.com", мы также автоматически посещаем родительские домены "leetcode.com" и "com". Домен с парным счетчиком - это домен, который имеет один из двух форматов "rep d1.d2.d3" или "rep d1.d2", где rep - это количество посещений домена, а d1.d2.d3 - это сам домен. Например, "9001 discuss.leetcode.com" - это домен с парным счетчиком, указывающий на то, что discuss.leetcode.com был посещен 9001 раз. Дан массив доменов с парными счетчиками cpdomains, верните массив доменов с парными счетчиками для каждого поддомена во входных данных. Вы можете вернуть ответ в любом порядке. Пример: Input: cpdomains = ["9001 discuss.leetcode.com"] Output: ["9001 leetcode.com","9001 discuss.leetcode.com","9001 com"] Explanation: We only have one website domain: "discuss.leetcode.com". As discussed above, the subdomain "leetcode.com" and "com" will also be visited. So they will all be visited 9001 times. 👨💻 Алгоритм: 1⃣Следуем указаниям из условия задачи. 2⃣Для адреса вида a.b.c, подсчитываем a.b.c, b.c и c. Для адреса вида x.y, подсчитываем x.y и y. 3⃣Для подсчета этих строк используем хеш-таблицу. Для разделения строк на требуемые части используем библиотечные функции split. 😎 Решение: using System; using System.Collections.Generic; public class Solution { public IList SubdomainVisits(string[] cpdomains) { var ans = new Dictionary(); foreach (var domain in cpdomains) { var parts = domain.Split(' '); var count = int.Parse(parts[0]); var frags = parts[1].Split('.'); for (int i = 0; i < frags.Length; i++) { var subdomain = string.Join(".", frags, i, frags.Length - i); if (ans.ContainsKey(subdomain)) { ans[subdomain] += count; } else { ans[subdomain] = count; } } } var res = new List(); foreach (var entry in ans) { res.Add($"{entry.Value} {entry.Key}"); } return res; } } Ставь 👍 и забирай 📚 Базу знаний
C# LeetCode - tasks
FAQ

Open C# LeetCode - tasks 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 C# LeetCode - tasks directly in Telegram unless the resource description says otherwise.

Access depends on the resource. Check the current information in Telegram after opening C# LeetCode - tasks.

The exact features depend on the resource. Open C# LeetCode - tasks to see its current functions, content and access conditions.
Subscriber dynamics
+-1.0% last 30 days
Current
3,158
Month ago
3,190
Average growth
+-1 / day
Updated
5 hours ago

Reviews for channel C# LeetCode - tasks

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