Search
⌘K

Leetcode 2515. Shortest Distance to Target String in a Circular Array

Given a circular array of strings and a start index, return the minimum number of steps (moving left or right with wraparound) needed to reach any occurrence of target, or -1 if target is absent. Essentially compute the smallest circular distance between startIndex and any index i where words[i] == target.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.