Problem 3740 · Easy

Minimum Distance Between Three Equal Elements I

Pick three equal values at indices i < j < k and minimize the sum of their pairwise index distances. Return -1 when no triple exists.

Open the interactive visualisation