Vector Distance
The Euclidean distance between two arrays of the same length is the square root of the sum of (a[i] - b[i]) ** 2 over all positions. Return it as a float.
Example 1
a [1,2,3]
b [4,6,3]
returns 5.0
The differences are 3, 4 and 0, so sqrt(9 + 16 + 0) = 5.0.
Constraints
1 <= len(a) = len(b) <= 50
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Weighted AverageEasy
- Weighted Row ScoresEasy
- Whole DollarsEasy
- Z-ScoresEasy
- Zero PositionsEasy
- Best Columns of Each RowMedium
- Cells Above Row AverageMedium
- Count Local PeaksMedium