Fastest Grid Route
Imagine a character moving on a grid map: in one step, they can move horizontally, vertically, or diagonally. Given a list of points points, visit them strictly in the given order. Return the minimum time needed to complete the whole route.
Примеры
Ввод
[[1, 1], [3, 4], [-1, 0]]Вывод
7Ввод
[[3, 2], [-2, 2]]Вывод
5Ввод
[[0, 0]]Вывод
0Нужно реализовать
def min_time_to_visit_all_points(points: list[list[int]]) -> int:
Теги
arraymath
Zaloguj się, aby zobaczyć historię rozwiązań
Zaloguj sięZaloguj się, aby korzystać z Mentora AI
Zaloguj sięVisible tests
1
Input
[[1,1],[3,4],[-1,0]]Expected
72
Input
[[3,2],[-2,2]]Expected
53
Input
[[0,0]]Expected
04
Input
[[1,1],[1,1]]Expected
05
Input
[[0,0],[5,5]]Expected
56
Input
[[-1,0],[3,4],[1,1]]Expected
7Focus radio
Paused · SomaFM · Fluid