Palindrome by Splitting
JJ has an array $A$ initially of length $N$. He can perform the following operation on $A$: **1)** Pick any index $i$ $(1 \le i \le |A|)$ such that $A_i \gt 1$ $\\$ **2)** Select any two integers $X$ and $Y$ such that $X + Y = A_i$ and $X, Y \ge 1$ $\\$ **3)** Replace $A_i$ with $X$ and $Y$ Note that the length of the array increases by $1$ after each operation. For example, if $A = [4, 6, 7, 2
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