Problem 2515 · Easy

Shortest Distance to Target String in a Circular Array

Measure each matching word's distance from the start in both circular directions and keep the smaller one.

Open the interactive visualisation