Minimum Time Visiting All Points Problem
Minimum Time Visiting All Points Problem — ExecCode Easy DSA Practice
Solve the Minimum Time Visiting All Points problem on ExecCode. Free online easy DSA practice in Arrays - Logic Building. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given the input needed to solve Minimum Time Visiting All Points. Your task is to compute the required answer and return the minimum time in seconds to visit all the points in the order given by points. On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. You can move according to these rules: - In 1 second, you can either: move vertically by one unit, move horizontally by one unit, or move diagonally sqrt(2) units (in other words, move one unit vertically then one unit horizontally in 1 second).
Examples
Input {"points": [[1, 1], [3, 4], [-1, 0]]}; Output 7. Input {"points": [[3, 2], [-2, 2]]}; Output 5
Constraints
points.length == n 1 <= n <= 100 points[i].length == 2 -1000 <= points[i][0], points[i][1] <= 1000
Practice Minimum Time Visiting All Points free on ExecCode. Browse DSA problems, topic map, and placement guides.