Word ladder (shortest path)
← run 2 · raw JSON · challenge definitions
—
score
tests (60%)—
deliverables (20%)—
content checks (20%)—
qwen3-30b-a3b: timed out
01 what the model was asked
Create ladder.py with exactly one function:
ladder_length(begin: str, end: str, word_list: list[str]) -> int
A transformation sequence goes from begin to end, changing exactly one letter per step; every intermediate word (and end itself) must appear in word_list. Return the number of words in the SHORTEST such sequence counting both endpoints, or 0 if none exists. begin does not need to be in word_list. All words are lowercase and the same length.
Example: begin="hit", end="cog", word_list=["hot","dot","dog","lot","log","cog"] -> 5 (hit -> hot -> dot -> dog -> cog).
Use only the Python standard library. A breadth-first search is the intended approach; brute-force recursion will be too slow for the larger test.
required deliverables + checks
✗deliverable: ladder.py
✗ladder.py must contain “def ladder_length”
pytest suite it was graded against
test_ladder.py · 27 lines · 744 B
import time from ladder import ladder_length def test_classic_example(): assert ladder_length("hit", "cog", ["hot", "dot", "dog", "lot", "log", "cog"]) == 5 def test_unreachable_end(): assert ladder_length("hit", "cog", ["hot", "dot", "dog", "lot", "log"]) == 0 def test_single_step(): assert ladder_length("a", "c", ["a", "b", "c"]) == 2 def test_shortest_is_found(): words = ["hot", "hit", "hat", "cat", "cot", "cog", "dog"] assert ladder_length("hit", "cot", words) == 3 def test_larger_input_is_fast(): words = [a + b + c for a in "abcdefgh" for b in "abcdefgh" for c in "abcdefgh"] start = time.monotonic() assert ladder_length("aaa", "hhh", words) == 4 assert time.monotonic() - start < 2.0
02 what it did — full transcript
! errorqwen3-30b-a3b: timed out
03 what it wrote
The model produced no files.
04 how it was graded
0
model calls
0
invalid actions
0
self test runs
—
tokens out
—
tokens in
906.1s
wall time
agent actions: —