Available question text
Given a list of words and two target words (which may be the same), find the minimum index distance between any occurrence of the two targets; if the targets are identical, compute the smallest distance between two distinct occurrences of that word. This is typically solved by a single pass tracking last-seen positions of the targets to minimize index difference.
Related questions
Continue with questions that share topics or the same question type.
- Shortest Word Distance
Coding · Array · String
- Shortest Word Distance II
Coding · Array · Design · Hash Table
- Find Shortest Distance Between Multiple Sources and Destinations in Matrix
Coding
- Minimum Distance to Type a Word Using Two Fingers
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 245. Shortest Word Distance III
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source