Frequency Function
Chef had a sequence $S_0, S_1, \ldots, S_{N-1}$; each element of this sequence was an integer between $0$ and $N-1$ (inclusive). Unfortunately, he forgot some (possibly zero or all) elements of this sequence. You are given a sequence $A_0, A_1, \ldots, A_{N-1}$, where for each valid $i$, $A_i = -1$ denotes an element Chef forgot and if $A_i \neq -1$, then $A_i = S_i$. Before Chef forgot any ele
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