450. How Many Numbers Are Smaller
EasyCounting Sort
For each element, print how many elements in the array are strictly smaller than it.
Input format
Line 1: n Line 2: n integers
Output format
n counts.
Example 1
Input
5 8 1 2 2 3
Output
4 0 1 1 3
Example 2
Input
4 6 5 4 8
Output
2 1 0 3
Constraints
1 ≤ n ≤ 10⁵ 0 ≤ a[i] ≤ 100
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…