Equality Etiquette
You have two integers $A$ and $B$, and you'd like to make them equal. To this end, you can perform several moves. On the $i$-th move, - If $i$ is odd, either add $i$ to $A$ or add $i$ to $B$. Note that you aren't allowed to add $i$ to both, and must choose exactly one of them. - If $i$ is even, either subtract $i$ from $A$ or subtract $i$ from $B$. Once again, you aren't allowed to subtract
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