Coding Trainer

Word Ladder

HardBFSLC #127

Problem

Transform beginWord to endWord by changing one letter at a time, each intermediate word in wordList. Return the number of words in the shortest transformation sequence (0 if impossible).

Example: beginWord="hit", endWord="cog", wordList=["hot","dot","dog","lot","log","cog"] → 5