No 4 Please
An array $B$ of length $M$ is said to be *good* if no two elements from different indices sum to $4$. That is, $B$ is *good* if for every pair $(i, j)$ satisfying $1 \le i \lt j \le M$, we have $(B_i + B_j) \ne 4$. --- You are given an array $A$ of length $N$ such that $1 \le A_i \le 3$ for each index $i$. You would like to make $A$ a *good* array. To achieve this, you can repeatedly ch
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