Let's say I have an list:
[4, 5, 2, 1]
I need to rank these and have the output as:
[3, 4, 2, 1]
If two have the same ranking in the case:
[4, 4, 2, 3] then the rankings should be averaged -> [3.5, 3.5, 1, 2]
EDIT
Here rank stands for position of number in a sorted list. If there are multiple numbers with same value, then rank of each such number will be average of their positions.