Given an array of distinct integers, we need to replace each element of the array with its rank. The minimum value element will have the highest rank.
For example, consider the array
A solution can be provided using maps. The array element and its index are stored in two columns in the map and later the index is replaced by the element’s rank.
@@coding::1@@
Recommended Programs