I want to find count of elements in an array which have the following two conditions:
- 1 <= i < j <= n
- a[i] > a[j]
Im using the following code but i need a faster one any advice?
for(int i=0; i<n; i++){
for (int j=i+1; j<n; ++j){
if (a[j] < a[i])
ans++;
}
}