On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points.

You can move according to these rules:


	In 1 second, you can either:

	
		move vertically by one&nbsp;unit,
		move horizontally by one unit, or
		move diagonally sqrt(2) units (in other words, move one unit vertically then one unit horizontally in 1 second).
	
	
	You have to visit the points in the same order as they appear in the array.
	You are allowed to pass through points that appear later in the order, but these do not count as visits.


&nbsp;
Example 1:

Input: points = [[1,1],[3,4],[-1,0]]
Output: 7
Explanation: One optimal path is [1,1] -&gt; [2,2] -&gt; [3,3] -&gt; [3,4] -&gt; [2,3] -&gt; [1,2] -&gt; [0,1] -&gt; [-1,0]   
Time from [1,1] to [3,4] = 3 seconds 
Time from [3,4] to [-1,0] = 4 seconds
Total time = 7 seconds

Example 2:

Input: points = [[3,2],[-2,2]]
Output: 5


&nbsp;
Constraints:


	points.length == n
	1 &lt;= n&nbsp;&lt;= 100
	points[i].length == 2
	-1000&nbsp;&lt;= points[i][0], points[i][1]&nbsp;&lt;= 1000


class Solution:
    def minTimeToVisitAllPoints(self, points):
        res = 0
        n = len(points)
        for i in range(n-1):
            dx = abs(points[i+1][0]-points[i][0])
            dy = abs(points[i+1][1]-points[i][1])
            res+= max(dx,dy)
        return res

            
obj = Solution()
print(obj.minTimeToVisitAllPoints([[1,1],[3,4],[-1,0]]))
class Solution {
    public int minTimeToVisitAllPoints(int[][] points) {
        int max = 0, x, y;
        for(int i = 0; i < points.length - 1; i++){
            for(int j = 0; j < points[i].length - 1; j++){
                x = Math.abs(points[i][j] - points[i+1][j]);
                y = Math.abs(points[i][j+1] - points[i+1][j+1]);
                max += Math.max(x,y);
            }
        }
        return max;
    }
}
class Solution {
public:
    int minTimeToVisitAllPoints(vector<vector<int>>& points) {
        vector<int>sk;
        int x,y,maxy=0;
        for(int i=0;i<points.size()-1;i++){
            for(int j=0;j<points[i].size()-1;j++){
                x=abs(points[i][j]-points[i+1][j]);
                y=abs(points[i][j+1]-points[i+1][j+1]);
                maxy+=std::max(x,y);
            }
        }
        return maxy;
    }
};
/**
 * @param {number[][]} points
 * @return {number}
 */
var minTimeToVisitAllPoints = function(points) {
    let sum = 0;
    for(let i=1; i<points.length; i++){
        sum += Math.max(Math.abs(points[i][0] - points[i-1][0]) , Math.abs(points[i][1] - points[i-1][1]));
    }
    return sum;
};
Minimum Time Visiting All Points