Minimum Time Visiting All Points LeetCode solution in Java
1class Solution {2public int minTimeToVisitAllPoints(int[][] points) {3int max = 0, x, y;4for (int i = 0; i < points.length - 1; i++) {5for (int j = 0; j < points[i].length - 1; j++) {6x = Math.abs(points[i][j] - points[i + 1][j]);7y = Math.abs(points[i][j + 1] - points[i + 1][j + 1]);8max += Math.max(x, y);9}10}11return max;12}13}