Distinct Opposite Sums
Given an **even** integer $N$, output a *permutation* $P$ of length $N$, such that: - The value of $P_i + P_{N+1-i}$ is **distinct** for all $1 \leq i \leq \frac{N}{2}$. It is guaranteed that a possible solution always exists. If multiple such permutations exist, print any. Note that, a permutation $P$ of length $N$, consists of all integers from $1$ to $N$ exactly once. For example, $[2, 1, 3,
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