Skip to content

Commit b767951

Browse files
authored
Create 1266_Minimum_Time_Visiting_All_Points.java
1 parent fd3b980 commit b767951

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: 1266_Minimum_Time_Visiting_All_Points.java

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// id: 1266
2+
// Name: Minimum Time Visiting All Points
3+
// link: https://leetcode.com/problems/minimum-time-visiting-all-points/
4+
// Difficulty: Easy
5+
6+
class Solution {
7+
public int minTimeToVisitAllPoints(int[][] points) {
8+
int result = 0;
9+
10+
for (int i = 1; i < points.length; i++) {
11+
result += Math.max(Math.abs(points[i][0] - points[i-1][0]), Math.abs(points[i][1] - points[i-1][1]));
12+
}
13+
return result;
14+
}
15+
}
16+

0 commit comments

Comments
 (0)