Approach

since we need to walk point in order, just process one by one, and for each one the distance is max of the absolute difference in x and y direction.

Code

class Solution {
public:
    int minTimeToVisitAllPoints(vector<vector<int>>& points) {
        int dist = 0;
        for(int i = 1 ; i < points.size() ; ++i) {
            int dx = abs(points[i][0] - points[i-1][0]);
            int dy = abs(points[i][1] - points[i-1][1]);
            dist += max(dx, dy);
        }
        return dist;
    }
};