(1 ≤ N ≤ 1e+5)
I have to find how many cases in this condition:
i < j and array[i] > array[j]
here I have tried:
k = int(input())
n = tuple(map(int, input().split()))
h=0
i=0
j=0
for j in range(k-1):
for i in range(j+1,k):
if n[j]>n[i]:
h+=1
print(h)
but it gives time limit. is there better way to iterate it. Test case 1:
10
7 6 2 4 1 5 10 3 9 8