← All problemsSign in

Array Swaps

CodeChefRating 1619Open on judge ↗

Salmon received an array $A$ of size $N$ and an array $B$ of size $M$ for Christmas. He would like to move all the elements in $B$ to $A$ using a special method described below. While $B$ is not empty, Salmon does the following operations in order: * Remove and store the leftmost element off of B (let's call this element $X$). * Place $X$ at the start of $A$. * Keep swapping $X$ and the element

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start