Problem 1134. Get ranks of values in a vector

Created by Khaled Hamed

For a given vector, say [6 3 8 2], return the ranks (ascending) of observations, i.e. [3 2 4 1]. Do not worry about tied ranks. If ties exist, what comes first takes the lower rank, e.g., [1 1 3] returns [1 2 3]. More exact treatment of ties will follow. No toolbox functions please!

Tags

Problem Group

17 solvers submitted 34 solutions (2.0 solutions/solver).