New Operation
You are given an array $A$ of $N$ integers. You perform the following operation on it $N - 1$ times: - Choose index $i$ ($1 \le i < |A|$) and let $X = A_i + 2 \cdot A_{i + 1}$. - Delete $A_i$ and $A_{i + 1}$ from the array $A$. - Insert $X$ back to the array $A$ in the same place. More formally, you replace array $A$ with $A[1, i - 1] + [X] + A[i + 2, N]$, where $A[L, R]$ represents the subarr
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