245. Shortest Word Distance III

time: O(n)

space: O(1)

Example 2:

if use 244... 應該只要多加這個判斷, 同樣的 word1 word2, 最小距離會在相臨的

Last updated

Was this helpful?