Code Room
CodingEasycod-g975
Subject Machine learningLevel Entry–Mid~12 minCommon in ML systems interviewsIndustries Software development

Question

Given two equal-length numeric vectors, return both their Euclidean (L2) distance and their Manhattan (L1) distance as a two-element list [euclidean, manhattan]. Euclidean distance is the square root of the sum of squared differences; Manhattan distance is the sum of absolute differences. Inputs are non-empty lists of the same length. Round each distance to 4 decimal places.

Implement
distances(a: list[float], b: list[float]) → list[float]
Examples
in[[0,0],[3,4]]out[5,7]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.