Code Room
CodingMediumcod-g981
Subject Machine learningLevel Entry–Mid~18 minCommon in ML systems interviewsIndustries Software development

Question

Z-score standardize a non-empty list of numbers: each value becomes (x - mean) / std, where std is the population standard deviation (divide the variance by n, not n-1). If the standard deviation is zero (all values equal), return a list of all 0.0. Round each output to 6 decimal places.

Implement
zscore_normalize(xs: list[float]) → list[float]
Examples
in[[1,2,3]]out[-1.224745,0,1.224745]
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.