← All problemsSign in

Mega Mode

CodeChefRating 2384Open on judge ↗

You're given an array $A$ of length $N$, and an integer $K$. You can perform the following operation **exactly once**: - Choose **at most** $K$ *distinct* indices $i_1, i_2, \ldots, i_r$ ($r \le K$) - Then, add $1$ to each element at a chosen index. - That is, for each $1 \le j \le r$, add $1$ to $A_{i_j}$. An element $X$ is said to be a *mode* of the array $A$, if $X$ has the highest freque

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start