// Word Ladder — HARD
// Category: graph
A **transformation sequence** from word `beginWord` to word `endWord` using a dictionary `wordList` is a sequence `beginWord → s₁ → s₂ → ... → sₖ → endWord` such that:
- Every adjacent pair of words differs by exactly one letter.
- Every word in the sequence is in `wordList`.
Given `beginWord`, `endWord`, and `wordList`, return the **number of words** in the shortest transformation sequence, or `0` if no such sequence exists.
Example: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"]
Output: 5