Shortest Word Distance II

Try to solve the Shortest Word Distance II problem.

Statement

Design a data structure that takes in an array of strings and efficiently computes the shortest distance between any two different strings in the array.

Implement the WordDistance class:

    ...
    Access this course and 1400+ top-rated courses and projects.