Milk Van Route Total Distance
Milk Van Route Total Distance
MediumArrays0% accepted
A milk van departs from central depot (position 0) and visits multiple dairy farms. After each farm, it returns to depot before next delivery. Calculate total distance traveled.
Approach
Given farm positions array, calculate total distance: 0→farm[0]→0→farm[1]→0→...→farm[n-1]→0.
Input
4
10 20 15 30
Output
150
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards