Skip to content

Commit

Permalink
1266
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Jan 5, 2022
1 parent 0b5c785 commit 6394da0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions E_1266_MinimumTimeVisitingAllPoints.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public int minTimeToVisitAllPoints(int[][] points) {
int count = 0;
int x, y;
for (int i = 0; i < points.length - 1; i++) {
x = points[i][0];
y = points[i][1];
count+=Math.max(Math.abs(points[i + 1][0] - x), Math.abs(points[i +1][1] - y));
}
return count;
}

0 comments on commit 6394da0

Please sign in to comment.