LeetCode
Shortest Word Distance III
Click
here
for an explanation.