My issue
i need ans
My code
# Python3 program to count inversions in an array
# Function to count inversions in the array
def get_inv_count(arr):
n = len(arr)
inv_count = 0
for i in range(n - 1):
for j in range(i + 1, n):
# If the current element is greater than the next,
# increment the count
if arr[i] > arr[j]:
inv_count += 1
return inv_count
t = int(input())
for _ in range(t):
l = input()
arr = list(map(int, input().split() ))
print(get_inv_count(arr))
Learning course: Design and Analysis of Algorithms
Problem Link: https://www.codechef.com/learn/course/kl-daa/KLDAA2402/problems/DAA014