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].
Process from right to left, maintaining sorted suffix