Problem 1182 · Medium

Shortest Distance to Target Color

Given colour labels on an array, answer queries that ask for the nearest index carrying a requested colour. The visual marks each colour's positions and the nearest hit from each query index.

Open the interactive visualisation