Premium problem146. Percentile Rank Each Value

Medium Locked

Given a 1-D numeric array of length n with no ties, return a float array of percentile ranks:

  • each element becomes rank / (n - 1), in [0, 1]
  • rank 0 is the smallest value

Input

[30. 10. 20. 40.]

Output

[0.66666667 0.         0.33333333 1.        ]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)