Question bank › Recursion
Dsa Recursion Hard

Word Ladder Transformation Count

You are given two words, and a dictionary of valid words. Write a function to count the minimum number of transformations required to convert the first word to the second word, changing one letter at a time. Each transformed word must exist in the dictionary. The input is a list of words comprising the dictionary and two words as input. The function should output the count of transformations required (if possible) or -1 if it’s not possible. Input Format: - First line: word_list (space-separated words) - Second line: start_word - Third line: end_word Output Format: - An integer representing the minimum number of transformations required. Example: Input: dog dot dat cat dog dat Output: 2

Key concepts

recursiongraphsstrings

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.