Perfect Imperfections 2
An array of integers is called *good* if all its elements are perfect squares. You are given an array $A$ of $N$ integers. In one move, you can do the following: - Pick a subset of indices of the array, say $\{i_1, i_2, \ldots, i_k\}$ where $1 \leq i_1 \lt i_2 \lt \ldots \lt i_k \leq N$ - Next, pick an integer $X \gt 0$ - Finally, multiply the value at each chosen index by $X$, i.e, set $A_{i_j}
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