As reported: Goldman Sachs Associate CoderPad round (2026), after 5–10 minutes of resume talk: Word Ladder.
Given beginWord, endWord and a dictionary wordList, a transformation changes one letter at a time and every intermediate word must be in wordList. Return the number of words in the shortest sequence from beginWord to endWord (counting both ends), or 0 if there is none.
This is LeetCode 127 — Word Ladder.
Example 1
beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
-> 5
Example 2
beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log"]
-> 0
Constraints: 1 ≤ beginWord.length ≤ 10; all words have the same length and are lowercase; 1 ≤ wordList.length ≤ 5000; beginWord ≠ endWord; words in wordList are unique.
Code runner format: one JSON value per line: beginWord, then endWord, then wordList (LeetCode's test-case format). Implement ladderLength(beginWord, endWord, wordList); the harness prints the result as JSON.