Count Strictly Smaller Later Occurrences for Every Position
Company: Google
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: hard
Interview Round: Other
### Problem
Return counts where counts[i] is the number of indices j>i with nums[j]<nums[i]. Equal later values do not count.
```cpp
vector<int> countSmaller(vector<int>& nums);
```
### Examples
```text
nums = [4,1,3,1] -> [3,0,1,0]
nums = [2,2] -> [0,0]
```
### Constraints
- Length is 1 through 100000.
- Values lie in [-10000,10000].
Overview: Count Strictly Smaller Later Occurrences for Every Position. For each array position, count later entries whose values are strictly smaller; equal values do not count.