Problem 3810 · Medium

Minimum Operations to Reach Target Array

One operation picks a value x and overwrites every maximal run equal to x with the target entries at those positions. Find the fewest operations that make nums equal target.

Open the interactive visualisation