Overwrite
You are given two arrays $A$ and $B$, of lengths $N$ and $M$ respectively ($M \leq N$). All the elements of $A$ are distinct, and all the elements of $B$ are distinct — that is, $A_i \neq A_j$ for $i \neq j$, and $B_i \neq B_j$ for $i \neq j$. In one operation, you can do the following: - Choose a subarray$^\dagger$ of $A$ with length $M$, and replace it with a cyclic rotation$^\ddagger$ of the
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