Problem
You want to turn begin into end by changing one letter at a time, and every intermediate word (and end itself) must appear in word_list. Return the number of words in the shortest such sequence, counting both begin and end. Return 0 if it cannot be done.
Example 1
begin = "red", end = "tax",
Example 2
word_list = ["ted", "tex", "red", "tax", "tad", "den", "rex", "pee"]
Example 3
→ 4 (red → ted → tad → tax)
Example 4
begin = "hot", end = "dog", word_list = ["hot", "dog"]
Example 5
→ 0 (no word sits one letter away from both)
Constraints
1 <= begin.length <= 10 and every word has the same length as begin1 <= word_list.length <= 5000Words use lowercase English letters only, begin != end, and begin does not need to be in the list.