Search
⌘K
Get Premium
Leetcode 244. Shortest Word Distance II
Given a list of words, design a class that can answer repeated queries returning the minimum index distance between two given words; optimize for many queries by preprocessing each word’s positions and computing the smallest gap between their index lists efficiently.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.