Search⌘ K
AI Features

Shortest Word Distance II

Explore how to implement the WordDistance class that initializes with an array of strings and efficiently computes the shortest distance between any two different words. Understand problem constraints and practice coding this custom data structure to handle up to 1000 queries effectively.

Statement

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