Given a list of words, find the absolute minimum distance between two words.

example input:
["a", "b", "c", "a", "d"]

example output:
min_distance("a", "c") = 1

explanation:
"c" is in index 2 and "a" is in index 0 and 3. |3 - 2| = 1

Comments (8)