Daily challenge for 2025-05-29
149. Word Ladder
Write a function solve that takes two words, begin_word and end_word, and a list of words word_list. The function should return the length of the shortest transformation sequence from begin_word to end_word where each transformation changes exactly one letter. If no such transformation sequence exists, return 0.
Example:Input: begin_word = "hit", end_word = "cog", word_list = ["hot","dot","dog","lot","log","cog"]Output: 5
Explanation: The shortest transformation is "hit" -> "hot" -> "dot" -> "dog" -> "cog" with a length of 5.
Run this challenge interactively in Python or JavaScript when the app loads.