Circular Trouble
You are given two arrays $A$ and $B$, of lengths $N$ and $M$ respectively. You are also given an empty array $C$. In one operation you can: 1. Append the entirety of $A$ to $C$; or 2. Increase any element of $C$ by $1$. Find the minimum number of operations needed such that $B$ becomes a subsequence of $C$ or print $-1$ if it is impossible to make $B$ as a subsequence of $C$ after some number of
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