Examples :
Input: [2, 3, 1, 4, 5] Output: [2 , 0, 1, 3, 4] After sorting list becomes [1, 2, 3, 4, 5] and their index as [2, 0, 1, 3, 4] Input: [6 , 4, 7, 8, 1] Output: [4, 1, 0, 2, 3] After sorting the list becomes [1, 4, 6, 7, 8] and their index as [ 4, 1, 0, 2, 3].
Method 1
|
Output:
[2, 0, 1, 3, 4]
Method 2
|
Output:
[2, 0, 1, 3, 4]