Plus-Minus Split
You are given an array $A$ of length $N$. The array can be modified by performing the following operation on it: - Choose an index $i$ ($1 \le i \le N$). - Then, for each index $j$ ($1 \le j \le N$), - If $j \lt i$, add $A_i$ to $A_j$. - If $j \ge i$, subtract $A_i$ from $A_j$ instead. Note that every element of $A$ *must* be modified - you cannot leave elements unchanged. For example,
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