result
to store the counts for each element.nums
using an outer loop with index i
.i
, initialize a counter count
to 0.nums
again using an inner loop with index j
.nums[j]
is less than nums[i]
and j
is not equal to i
, increment count
.count
to the result
list.result
list after the outer loop completes.