1.简述：

``````输入：start = "AACCGGTT", end = "AACCGGTA", bank = ["AACCGGTA"]

``````输入：start = "AACCGGTT", end = "AAACGGTA", bank = ["AACCGGTA","AACCGCTA","AAACGGTA"]

``````输入：start = "AAAAACCC", end = "AACCCCCC", bank = ["AAAACCCC","AAACCCCC","AACCCCCC"]

2.代码实现：

``````class Solution {
public int minMutation(String start, String end, String[] bank) {
Set<String> cnt = new HashSet<String>();
Set<String> visited = new HashSet<String>();
char[] keys = {'A', 'C', 'G', 'T'};
for (String w : bank) {
}
if (start.equals(end)) {
return 0;
}
if (!cnt.contains(end)) {
return -1;
}
Queue<String> queue = new ArrayDeque<String>();
queue.offer(start);
int step = 1;
while (!queue.isEmpty()) {
int sz = queue.size();
for (int i = 0; i < sz; i++) {
String curr = queue.poll();
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 4; k++) {
if (keys[k] != curr.charAt(j)) {
StringBuffer sb = new StringBuffer(curr);
sb.setCharAt(j, keys[k]);
String next = sb.toString();
if (!visited.contains(next) && cnt.contains(next)) {
if (next.equals(end)) {
return step;
}
queue.offer(next);