# Harder divide and conquer problems

## Count of Smaller Numbers after Self

You are given an integer array nums and you have to return a new counts array. The counts array has the property where `counts[i]`

is the number of smaller elements to the right of `nums[i]`

.

Input:

` [5,2,6,1]`

Output:

` [2,1,1,0]`

Explanation:

For the number 5, there are 2 numbers smaller than it after it. (2 and 1)

For the number 2, there is 1 number smaller than it after it. (1)

For the number 6, there is also 1 number smaller than it after it. (1)

For the number 1, there are no numbers smaller than it after it.

Hence, we have `[2, 1, 1, 0]`

.

### Try it yourself

Loading full content...