Skip to content

Commit 4d03d5d

Browse files
add skeleton for 1266
1 parent 04ac9c3 commit 4d03d5d

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Your ideas/fixes/algorithms are more than welcome!
2727

2828
| # | Title | Solutions | Time | Space | Video | Difficulty | Tag
2929
|-----|----------------|---------------|---------------|---------------|--------|-------------|-------------
30+
|1266|[Minimum Time Visiting All Points](https://leetcode.com/problems/minimum-time-visiting-all-points/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1266.java) | | | |Easy||
3031
|1252|[Cells with Odd Values in a Matrix](https://leetcode.com/problems/cells-with-odd-values-in-a-matrix/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1252.java) | O(m*n + k) | O(m*n) | |Easy||
3132
|1237|[Find Positive Integer Solution for a Given Equation](https://leetcode.com/problems/find-positive-integer-solution-for-a-given-equation/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1237.java) | | | |Easy||
3233
|1217|[Play with Chips](https://leetcode.com/problems/play-with-chips/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1217.java) | | | |Easy||
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.fishercoder.solutions;
2+
3+
/**
4+
* 1266. Minimum Time Visiting All Points
5+
*
6+
* On a plane there are n points with integer coordinates points[i] = [xi, yi].
7+
* Your task is to find the minimum time in seconds to visit all points.
8+
*
9+
* You can move according to the next rules:
10+
* In one second always you can either move vertically, horizontally by one unit or diagonally
11+
* (it means to move one unit vertically and one unit horizontally in one second).
12+
* You have to visit the points in the same order as they appear in the array.
13+
*
14+
* Example 1:
15+
* Input: points = [[1,1],[3,4],[-1,0]]
16+
* Output: 7
17+
* Explanation: One optimal path is [1,1] -> [2,2] -> [3,3] -> [3,4] -> [2,3] -> [1,2] -> [0,1] -> [-1,0]
18+
* Time from [1,1] to [3,4] = 3 seconds
19+
* Time from [3,4] to [-1,0] = 4 seconds
20+
* Total time = 7 seconds
21+
*
22+
* Example 2:
23+
* Input: points = [[3,2],[-2,2]]
24+
* Output: 5
25+
*
26+
* Constraints:
27+
* points.length == n
28+
* 1 <= n <= 100
29+
* points[i].length == 2
30+
* -1000 <= points[i][0], points[i][1] <= 1000
31+
* */
32+
public class _1266 {
33+
public static class Solution1 {
34+
public int minTimeToVisitAllPoints(int[][] points) {
35+
//TODO: implement it
36+
return -1;
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)