Search
⌘K

Leetcode 1848. Minimum Distance to the Target Element

Given an array, a target value, and a start index, return the minimum absolute distance |i - start| to any index i where nums[i] == target. The task is essentially to find the nearest occurrence of target by index (e.g., by scanning or expanding outward), with target guaranteed to exist.


Question Timeline

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

Comments

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