Min-max normalization
Min-max normalize a non-empty list of numbers to the range [0, 1]: each value becomes (x - min) / (max - min). If all values are equal (max == min), the denominator is zero — in that case return a list of all 0.0 of the same length. Round each output to 6 decimal places.
Implement
min_max_normalize(xs: list[float]) → list[float]Examples
in
[[0,5,10]]out[0,0.5,1]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.
0:00 of about 15 min
solution.py
InputExpectedGot
[[0,5,10]][0,0.5,1]not run yetsample