Minimum Time Visiting All Points LeetCode solution in C++

1
class Solution {
2
public:
3
int minTimeToVisitAllPoints(vector<vector<int>> &points) {
4
vector<int> sk;
5
int x, y, maxy = 0;
6
for (int i = 0; i < points.size() - 1; i++) {
7
for (int j = 0; j < points[i].size() - 1; j++) {
8
x = abs(points[i][j] - points[i + 1][j]);
9
y = abs(points[i][j + 1] - points[i + 1][j + 1]);
10
maxy += std::max(x, y);
11
}
12
}
13
return maxy;
14
}
15
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0