Problem 3086 · Hard

Minimum Moves to Pick K Ones

Alice stands at a chosen index of a binary array, collecting a one there for free, and must collect k ones in as few moves as possible. A move either turns a zero elsewhere into a one, at most maxChanges times, or swaps an adjacent one and zero, collecting the one if it lands on her index.

Open the interactive visualisation