11610

To solve the problem indexes of the array are also needed to be updated and queried.

 

10666

 

1428

The problem can be solved using Binary Indexed tree or Fenwick tree.

To know something More. From the above source:

Sample code implementing the binary indexed tree data structure to find the # of smaller numbers than a number of an array.

 

12532