package leetcode;

/**
 * https://leetcode.com/problems/minimum-genetic-mutation/
 */
public class Problem433 {
    public int minMutation(String start, String end, String[] bank) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem433 prob = new Problem433();
        System.out.println(prob.minMutation("AACCGGTT", "AACCGGTA", new String[]{"AACCGGTA"})); // 1
        System.out.println(prob.minMutation("AACCGGTT", "AAACGGTA", new String[]{"AACCGGTA", "AACCGCTA", "AAACGGTA"})); // 2
        System.out.println(prob.minMutation("AAAAACCC", "AACCCCCC", new String[]{"AAAACCCC", "AAACCCCC", "AACCCCCC"})); // 3
    }
}

@@ -12,16 +12,118 @@
 tcode;%0A%0A
+import java.util.HashSet;%0Aimport java.util.LinkedList;%0Aimport java.util.Queue;%0Aimport java.util.Set;%0A%0A
 /**%0A * h
@@ -289,32 +289,890 @@
     
-// TODO%0A        return 0
+char%5B%5D chars = new char%5B%5D%7B'A', 'C', 'G', 'T'%7D;%0A        Set%3CString%3E set = new HashSet%3C%3E();%0A        for (String s : bank) %7B%0A            set.add(s);%0A        %7D%0A        boolean found = false;%0A        Queue%3CString%3E queue = new LinkedList%3C%3E();%0A        int count = 0;%0A        queue.add(start);%0A        while (!queue.isEmpty()) %7B%0A            String s = queue.remove();%0A            count++;%0A            if (s.equals(end)) %7B%0A                found = true;%0A                break;%0A            %7D%0A            for (int i = 0; i %3C s.length(); i++) %7B%0A                char%5B%5D tmp = s.toCharArray();%0A                for (char c : chars) %7B%0A                    tmp%5Bi%5D = c;%0A                %7D%0A                String adjacent = new String(tmp);%0A                if (set.contains(adjacent)) %7B%0A                    queue.add(adjacent);%0A                %7D%0A            %7D%0A        %7D%0A        return (found) ? count : -1
 ;%0A  
@@ -1366,16 +1366,18 @@
 ); // 1%0A
+//
         
@@ -1493,16 +1493,18 @@
 ); // 2%0A
+//
         

Update problem 433