类似于曼哈顿距离
class Solution {
public:
int minTimeToVisitAllPoints(vector<vector<int>>& points) {
//注意题目要求:必须按照数组顺序访问
int sum = 0, f1, s1, f2, s2;
int n = points.size();
for(int i = 1; i < n; i++){
f1 = points[i-1][0];
s1 = points[i-1][1];
f2 = points[i][0];
s2 = points[i][1];
sum += max(abs(f1-f2), abs(s1-s2));
}
return sum;
}
};