← 返回 meta 的题目列表Find Element Rankings After Sorting Array Ascending
类型:online_judge
meta
Given an integer array arr, perform an ascending sort of the array and output the ranking of elements in the original array as their indices after sorting. Return an array of the same length as arr where each element represents the ranking of the corresponding element in arr.
Input/Output Requirements
Input: arr, an array of integers with length in the range [1, 10^5], with values between [-10^9, 10^9].
Output: An array of integers of the same length as arr.
Example Input
[40, 10, 20, 30]
Example Output
[4, 1, 2, 3]
Example
Input
[40, 10, 20, 30]