Free written solution

Minimum Distance to the Target Element (LeetCode 1848): Solution and Explanation

Given an array, a target value and a start index, return the smallest distance from start to any index that holds the target.

Read the intuition, approach, code and complexity →