### Problem
Start at points[0] and visit all listed points in their given order. Each second may change x by one unit, y by one unit, or both by one unit diagonally. Return the least total seconds. Passing through a later point early does not count as its ordered visit.
```cpp
class Solution {
public:
int minTimeToVisitAllPoints(vector<vector<int>>& points);
};
```
### Examples
**Example 1:**
```text
Input: points = [[0,0],[2,1],[2,-2]]
Output: 5
Explanation: The first segment needs2 seconds and the second needs3.
```
**Example 2:**
```text
Input: points = [[-1,4],[-1,4]]
Output: 0
Explanation: Repeated consecutive points need no movement.
```
### Constraints
- There are 1 to 100 points, each a pair of integers.
- Every coordinate is in `[-1000,1000]`.
### Contract considerations
All points must be visited in the input order, including duplicates.
```hint Read the boundary condition
Does passing through a later waypoint complete its visit before earlier waypoints, and how are repeated waypoints handled?
```
### Boundary reminders
All points must be visited in the input order, including duplicates.
Overview: Fastest Ordered Visit of Integer Points. Start at points[0] and visit all listed points in their given order.
Start at points[0] and visit all listed points in their given order. Each second may change x by one unit, y by one unit, or both by one unit diagonally. Return the least total seconds. Passing through a later point early does not count as its ordered visit.
class Solution {
public:
int minTimeToVisitAllPoints(vector<vector<int>>& points);
};
Examples
Example 1:
Input: points = [[0,0],[2,1],[2,-2]]
Output: 5
Explanation: The first segment needs2 seconds and the second needs3.
Example 2:
Input: points = [[-1,4],[-1,4]]
Output: 0
Explanation: Repeated consecutive points need no movement.
Constraints
There are 1 to 100 points, each a pair of integers.
Every coordinate is in
[-1000,1000]
.
Contract considerations
All points must be visited in the input order, including duplicates.
Boundary reminders
All points must be visited in the input order, including duplicates.