Summary of "JetBrains Youth Coding Club 2024-2025, Contest 20"

General Overview

The video covers the discussion and solution approaches for Contest 20 problems in the JetBrains Youth Coding Club 2024-2025. The contest is described as challenging, especially the last two problems. The speaker explains problem-solving strategies, mostly focusing on greedy algorithms and dynamic programming on trees.


Problem-by-Problem Summary

Problem A: Sum of Digits (String and Integer Handling)

Task: Calculate the sum of digits of a large integer given as a string, repeatedly until the number is reduced.

Approach:

Notes:


Problem B: Subsequence Check (“hello”)

Task: Check if the string "hello" appears as a subsequence in the input string.

Approach: Greedy algorithm

Concept: Greedy subsequence search.


Problem C: Minimizing Distinct Characters by Removal

Task: Remove up to K characters from a string to minimize the number of distinct characters.

Approach: Greedy

Concept: Greedy frequency-based removal.


Problem D: Make Array Elements Distinct by Increasing

Task: Given an array, increase some elements so all are distinct and ≥ original values.

Approach:

Complexity: O(N log N) due to sorting.

Concept: Greedy incremental adjustment.


Problem E: Increase Array Elements to Reach Average with Cost

Task: Increase array elements (up to a max limit R) to ensure average ≥ given value, minimizing cost.

Approach:

Concept: Greedy cost optimization.


Problem F: Two-Player Number Game with Modulo Condition

Task: Two players pick 9-digit numbers X and Y (≤ A and B respectively). The second player wins if (10^9 * X + Y) mod M = 0.

Approach:

Concept: Modular arithmetic and brute force over constrained range.


Problem G: Queries on Balanced Binary Tree for Happiness Sum

Task: Given a balanced binary tree, for queries (node, H), compute sum over nodes within distance < H of (H - distance).

Approach:

Complexity: O(N log N) preprocessing, O(log² N) per query.

Concept: Tree decomposition, binary search, prefix sums.


Problem H: Maximum Height of Full K-ary Subtrees

Task: For each node and each k, find the maximum height of a full k-ary subtree rooted at that node.

Challenges:

Approach:

Concept: DP on trees, function inversion, grouping by height.


Key Concepts and Methodologies


Speakers/Sources Featured


This summary encapsulates the main lessons, algorithmic strategies, and coding insights from the video, providing a clear outline of the contest problems and their solutions.

Category ?

Educational

Share this summary

Featured Products

Video