City Block Distance
Return the city block distance between points a and b: the sum of the absolute differences of their coordinates, as if you could only walk along a grid.
Example 1
a [0,0]
b [3,4]
returns 7
3 across and 4 up.
Constraints
1 <= len(a) == len(b) <= 10-50 <= a[i], b[i] <= 50
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Percent at or BelowBeginner
- Standard ErrorBeginner
- Standard ScoresBeginner
- The ModeBeginner
- Which Way It LeansBeginner
- At Least K WinsEasy
- Best Fit LineEasy
- Calls in an HourEasy