package leetcode;

/**
 * https://leetcode.com/problems/escape-the-ghosts/
 */
public class Problem789 {
    public boolean escapeGhosts(int[][] ghosts, int[] target) {
        // TODO
        return false;
    }

    public static void main(String[] args) {
        Problem789 prob = new Problem789();
        System.out.println(prob.escapeGhosts(new int[][]{
            {1, 0},
            {0, 3}
        }, new int[]{0, 1})); // true
        System.out.println(prob.escapeGhosts(new int[][]{
            {1, 0},
        }, new int[]{2, 0})); // false
        System.out.println(prob.escapeGhosts(new int[][]{
            {2, 0},
        }, new int[]{1, 0})); // false
    }
}

@@ -174,36 +174,354 @@
     
-// TODO%0A        return false
+int distance1 = Integer.MAX_VALUE;%0A        for (int%5B%5D ghost : ghosts) %7B%0A            distance1 = Math.min(distance1, shortestPath(ghost, target));%0A        %7D%0A        int distance2 = shortestPath(new int%5B%5D%7B0, 0%7D, target);%0A        return distance2 %3C distance1;%0A    %7D%0A%0A    private static int shortestPath(int%5B%5D source, int%5B%5D target) %7B%0A        return 0
 ;%0A  

Update problem 789