Given an array of strings words and two distinct words word1 and word2, return the shortest distance between their positions in the array.
Enable JavaScript for the full StreamPrep guide.