Mode!
You are given an array $A$ consisting of $N$ positive integers. In one operation, you can replace an element $A_i$ $(1\le i \le N)$ with any positive integer $X$ $(1\le X \le 10^9)$. For each $1\le i \le N$, find the **minimum** number of operations required to make the number of modes in the array **exactly** equal to $i$. If it is not possible to do so for any $i$, print $-1$ corresponding
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.
Sign in to chat with the tutor and save your progress.
Sign in to start