You are given two gene strings startGene and endGene, along with a list bank of valid gene strings. A single mutation changes exactly one character in the current gene to a different character.
Return the minimum number of mutations needed to transform startGene into endGene, where every intermediate gene string produced during the process must appear in bank. If it is impossible to reach endGene under these rules, return
Implement int minMutation(str startGene, str endGene, List[str] bank).
Note: Each mutation must change exactly one position, and every intermediate gene must be contained in
bank.
Constraints:
bank.length
startGene.length endGene.length bank[i].length
startGene, endGene, and bank[i] consist only of the characters ['A', 'C', 'G', 'T']
You are given two gene strings startGene and endGene, along with a list bank of valid gene strings. A single mutation changes exactly one character in the current gene to a different character.
Return the minimum number of mutations needed to transform startGene into endGene, where every intermediate gene string produced during the process must appear in bank. If it is impossible to reach endGene under these rules, return
Implement int minMutation(str startGene, str endGene, List[str] bank).
Note: Each mutation must change exactly one position, and every intermediate gene must be contained in
bank.
Constraints:
bank.length
startGene.length endGene.length bank[i].length
startGene, endGene, and bank[i] consist only of the characters ['A', 'C', 'G', 'T']