Distinct Neighbours
You are given an array $A$ of length $2\cdot N$. You also have an **empty** array $B$. You are asked to do the following operation exactly $N$ times. - Choose two **distinct** indices $x$ and $y$ $(1\le x,y \le |A|)$; - Append $(A_x - A_y)$ to the end of array $B$; - Delete the $x^{th}$ and $y^{th}$ elements from $A$ and concatenate remaining elements without changing the order. Find whether t
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