Minimum Genetic Mutation
Medium · Queue & Deque · about 20 minutes
Asked at Google, Amazon, Microsoft, Meta.
A gene is an 8-character string of 'A', 'C', 'G', 'T'. One mutation changes a single character, and every intermediate gene (and the end gene) must be in bank. Return the minimum number of mutations from startGene to endGene, or -1 if impossible.