Make It Special
A *special permutation* of size $n$ is a sequence of $n$ non-negative integers that includes each integer from the range $[l, l + n - 1]$ exactly once, where $l$ represents the smallest element in the sequence. For example, the sequences $[4, 3, 5]$ and $[1, 2, 3]$ are special permutations, while the sequences $[-1, 2, 0]$ and $[1, 3, 5]$ are not. You have a permutation $A$ of size $N$. An in
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