Problem 2260 · Medium

Minimum Consecutive Cards to Pick Up

Remember the latest index of each card value in a hash map; the closest repeat of a value gives the shortest run.

Open the interactive visualisation