Euclidean Distance

EasyMachine LearningMathTree

Description

Given two equal-length points a and b, return the Euclidean (L2) distance between them, rounded to 4 decimal places.

Examples

Input:a = [0,0], b = [3,4]
Output:5
Explanation:

Taking the square root of the summed squared differences gives 5.

Input:a = [1,1], b = [1,1]
Output:0
Explanation:

Taking the square root of the summed squared differences gives 0.

Input:a = [1,2,3], b = [4,5,6]
Output:5.1962
Explanation:

Taking the square root of the summed squared differences gives 5.1962.

Constraints

  • 1 ≤ a.length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.