Skip to content

Files

Latest commit

7a7d3f2 · Oct 20, 2020

History

History

0245.Shortest Word Distance III

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Oct 20, 2020
Oct 20, 2020
Aug 20, 2020

English Version

题目描述

给定一个单词列表和两个单词 word1word2,返回列表中这两个单词之间的最短距离。

word1word2 是有可能相同的,并且它们将分别表示为列表中两个独立的单词。

示例:
假设 words = ["practice", "makes", "perfect", "coding", "makes"].

输入: word1 = “makes”, word2 = “coding”
输出: 1
输入: word1 = "makes", word2 = "makes"
输出: 3

注意:
你可以假设 word1word2 都在列表里。

解法

Python3

Java

...