← Back to problems
UNSW COMP2041 · hard

22T2 Q11 — onesie (word ladder, BFS)

Args: a wordlist filename, a start word, a target word. Two words are linked if they have the same length and differ in exactly one position. Print a shortest chain from start to target (inclusive), one word per line, using only words from the list. If unreachable, print No solution. (Ties: BFS scanning candidate words in sorted order.)


Python only. From COMP2041/9044 22T2 Final.