Maximize Magical Wands
CodeChefOpen on judge ↗
Harry has $N$ magic wands and an array $A$ denoting the powers of the magic wands, the power of $i$'th magic wand is $A[i]$, $ 1 \leq i \leq N$. While selecting wands, Harry has to follow a special condition: If the power of a magic wand is $x$, he is allowed to select exactly $x$ such magic wands. After selecting them, he cannot choose any wand with power $x$. Help Harry to find the $maximum$ n
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