Amazon interview question

Word Ladder leet code question