简单题
class Solution {
public:
int distance(vector<int>& point1, vector<int>& point2){
int disx = abs(point1[0]-point2[0]);
int disy = abs(point1[1]-point2[1]);
int min = disx>disy?disy:disx;
return min + (disx-min) + (disy-min);
}
int minTimeToVisitAllPoints(vector<vector<int>>& points) {
int res = 0;
for(int i=1;i<points.size();i++){
res += distance(points[i-1], points[i]);
}
return res;
}
};