Adjacent Sum Array
Chef had an array $A$ of length $N$ of **positive** integers. He calculated an array $B$ of $N - 1$ integers, where $B_i = A_i + A_{i + 1}$. For example, if $A = [2, 5, 4]$, he got $B = [2 + 5, 5 + 4] = [7, 9]$. Unfortunately, Chef has forgotten the array $A$, and the elements in his sequence $B$ have been shuffled. Given the shuffled sequence $B$, predict the original array $A$. If multiple ans
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