Search⌘ K
AI Features

Shortest Word Distance II

Explore how to design an efficient custom data structure to solve the shortest word distance problem. You will implement the WordDistance class, initialize it with an array of strings, and create a method to return the shortest distance between any two different words. This lesson helps you apply data structure concepts to optimize query performance for repeated shortest distance calculations.

Statement

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