Path Length
points is a 2-D array with one [x, y] point per row. A hiker walks in straight lines from each point to the next one. Return the total distance walked as a float (0.0 if there is only one point).
Example 1
points [[0,0],[3,4],[3,10]]
returns 11.0
First leg 5, second leg 6, total 11.0.
Constraints
1 <= len(points) <= 50
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Rank of Each ScoreMedium
- Ranks Without GapsMedium
- Record HighsMedium
- Risk of a MixMedium
- Row SharesMedium
- Sort by First ColumnMedium
- Subtract Row MinimumMedium
- Unit VectorsMedium