Count of Smaller Numbers After Self
Given an integer array nums, return an integer array counts where counts[i] is the number of smaller elements to the right of nums[i].
Count of Smaller Numbers After Self

Given an integer array nums, return an integer array counts where counts[i] is the number of smaller elements to the right of nums[i].

Example 1:
Input: {"nums":[5,2,6,1]}
Output: [2,1,1,0]
Input
arr ={"nums":[5,2,6,1]}

Process from right to left, maintaining sorted suffix

Original Array
5
idx:0
2
idx:1
6
idx:2
1
idx:3
Counts (smaller numbers to the right)
-
-
-
-
Variables
No variables to display
DepthFunction Call
Stack empty
0/5