Scale to Zero One
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
2 <= len(nums) <= 100- The numbers are not all equal
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Second LargestEasy
- Smallest PositiveEasy
- Softmax WeightsEasy
- Sort Each RowEasy
- Strong RowsEasy
- Total Over LimitEasy
- Trend SlopeEasy
- Trimmed MeanEasy