Question bank › Graphs Bfs
Dsa Graphs Bfs Medium

Word Ladder

You are given a start word, an end word, and a list of words. Each word has the same length, and only one letter can be changed at a time to form a new valid word. Find the length of the shortest transformation sequence from start to end, or return 0 if no such sequence exists. Input format: The first line contains three components: 'start', 'end', and an integer 'n'. The next 'n' lines each contain one word that is also of the same length. Output format: An integer representing the number of transformation steps or 0 if no transformation is possible. Example: Input: hit cog 5 hot dot dog lot log Output: 5

Key concepts

graphsbfsword transformation

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.