Hard
Count of Smaller Numbers After Self
Hard
5 submissions
50 coins
+200 XP
Binary Search
Divide and Conquer
Merge Sort
Problem Description
For each index `i`, count how many elements to the right of `i` are strictly smaller than `nums[i]`, and return those counts.
**Example 1:**
```
Input: nums = [5, 2, 6, 1]
Output: [2, 1, 1, 0]
```
**Example 2:**
```
Input: nums = [-1]
Output: [0]
```
**Example 3:**
```
Input: nums = [-1, -1]
Output: [0, 0]
```
Constraints
- `1 <= nums.length <= 10^5`
- `-10^4 <= nums[i] <= 10^4`
Need help?
Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.
Video Call
Whiteboard
Live Coding
Screen Share