package leetcode;

/**
 * https://leetcode.com/problems/minimum-time-visiting-all-points/
 */
public class Problem1266 {
    public int minTimeToVisitAllPoints(int[][] points) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1266 prob = new Problem1266();
        System.out.println(prob.minTimeToVisitAllPoints(new int[][]{{1,1},{3,4},{-1,0}})); // 7
        System.out.println(prob.minTimeToVisitAllPoints(new int[][]{{3,2},{-2,2}})); // 5
    }
}

@@ -183,317 +183,390 @@
     
-// TODO%0A        return 0;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Problem1266 prob = new Problem1266()
+int answer = 0;%0A        for (int i = 0; i %3C points.length - 1; i++) %7B%0A            answer += chebyshev(points%5Bi%5D, points%5Bi + 1%5D);%0A        %7D%0A        return answer
 ;%0A    
+%7D%0A%0A
     
-System.out.println(prob.minTimeToVisitAllPoints(new int%5B%5D%5B%5D%7B%7B1,1%7D,%7B3,4%7D,%7B-1,0%7D%7D)); // 7%0A        System.out.println(prob.minTimeToVisitAllPoints(new int%5B%5D%5B%5D%7B%7B3,2%7D,%7B-2,2%7D%7D)); // 5
+private static int chebyshev(int%5B%5D point1, int%5B%5D point2) %7B%0A        // https://en.wikipedia.org/wiki/Chebyshev_distance%0A        return Math.max(Math.abs(point1%5B0%5D - point2%5B0%5D), Math.abs(point1%5B1%5D - point2%5B1%5D));
 %0A   

Solve problem 1266