Leetcode 243. Shortest Word Distance Python

preview_player
Показать описание
Full version of this LeetCode solution available on my Udemy course (100 LeetCode videos):
Рекомендации по теме
Комментарии
Автор

you could have initialized i1 and i2 with None, and in this case the check on line 10 will be- if i1 and i2:

The leetcode didn't let me to look this question, it wants me to pay for premium, glad to find it here, thank you!

scottishfoldmocha
Автор

Hi sorry I'm confusing cuz -1 in python is refers to the last element in the list not the out of bound index.

chuanyexiong