127-Word-Ladder
Fri 14 November 2025
https://leetcode.com/problems/word-ladder
import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
def ladderLength(self, beginWord: str, endWord: str, wordList: List[str]) -> int:
wordSet = set(wordList)
if endWord not in wordSet:
return 0
ans = 0
q = deque([beginWord])
while q:
ans …Category: leetcode
Read More