
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use the merge-sort technique.
Divide the array into two parts and sort them.
For each integer in the first part, count the number of integers that satisfy the condition from the second part. Use the pointer to help you in the counting process.