Problem 3229 · Hard

Minimum Operations to Make Array Equal to Target

Track the required differences; rises and falls in the same direction each cost one operation per unit, while opposite signs never share an operation.

Open the interactive visualisation