Find shortest transformation steps in a word graph
Company: Amazon
Role: Applied Scientist
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: This question evaluates a candidate's ability to model string transformations as a graph, apply graph traversal and shortest-path reasoning, and manage efficient string-based search and data-structure choices within the Coding & Algorithms domain.
Read the full Amazon Applied Scientist interview experience this question came from
Constraints
- Inputs are provided as Python literals compatible with the function signature.
- Return a deterministic value exactly matching the requested output.
Examples
Input: ('hit', 'cog', ['hot', 'dot', 'dog', 'lot', 'log', 'cog'])
Expected Output: 5
Explanation: Reachable ladder.
Input: ('hit', 'cog', ['hot', 'dot', 'dog', 'lot', 'log'])
Expected Output: 0
Explanation: End missing.
Hints
- Start with a direct data structure representation.
- Handle edge cases before the main loop.