Dabbling in Distribution
You are given an array $A$ of length $N$ containing positive integers. An index $i$ ($1 \le i \le N$) is called *active* if $A_i > 0$. You may modify the array by repeatedly performing the following operation: - Choose an **active** index $i$ with value $x = A_i$, such that $x$ is **strictly smaller** than the current number of active indices. - Set $A_i$ to $0$. Note that index $i$ is no long
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