Chebyshev Distance

EasyMachine LearningMath

Description

Given two equal-length vectors, return the Chebyshev distance between them: the maximum absolute difference across all coordinates.

Examples

Input:[1,2,3], [4,2,1]
Output:3
Explanation:

Chebyshev measures separation by the single coordinate where the two vectors differ most.

Input:[0,0], [3,4]
Output:4
Explanation:

Chebyshev measures separation by the single coordinate where the two vectors differ most.

Input:[1,1], [1,1]
Output:0
Explanation:

Chebyshev measures separation by the single coordinate where the two vectors differ most.

Constraints

  • 1 ≤ length ≤ 10⁴

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.