Word transformation sequence
Given a start word, an end word, and a word list, return the length of the shortest transformation sequence from start to end, where each step changes exactly one letter and every intermediate word (including the end) must be in the word list. The start word need not be in the list. All words have the same length and contain lowercase letters only. Return 0 if no such sequence exists. The sequence length counts the number of words in it (start and end inclusive).
Implement
word_ladder_length(start: str, end: str, words: list[str]) → intExamples
in
["hit","cog",["hot","dot","dog","lot","log","cog"]]out5What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 40 min
solution.py
InputExpectedGot
["hit","cog",["hot","dot","dog","lot","log","cog"]]5not run yetsample