FunctionRacerProblemsRace

Scale to Zero One

EasyNumPyPython

Rescale nums so the smallest value becomes 0 and the largest becomes 1, with everything else placed proportionally in between: (x - min) / (max - min). Return the new array.

Example 1

nums [10,20,40]
returns [0.0,0.3333333333333333,1.0]

The range is 30, so the results are 0, 1/3 and 1.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More NumPy problems