Set of students with different heights are standing in haphazard order. Now the task is to count number of swapping required to arrange them in increasing order of their heights.
If they are is already standing in increasing order then swap count is 0. If they are is already standing in decreasing order then swap count is the maximum.
Constraints:
1 ≤ T ≤ 5
1 ≤ N ≤ 500
1 ≤ C ≤ 1500
Input:
The first line of input contains an integer T denoting the number of test cases. The first line of each test case is N, the size of array. The second line of each test case contains N elements.
Output:
Display the swap count.
Sample Input 1:
1
4
10 20 50 40
Sample Output 1:
1
Sample Input 2:
1
5
2 4 1 3 5
Sample Output 2:
3
Explanation:
In Example-1: [10,20,50,40] has one swaps (50 40)
Answers
Answered by
0
Answer:
this is maths sum nit computer sum you don't no
Similar questions
Computer Science,
2 months ago
Math,
2 months ago
Social Sciences,
2 months ago
Computer Science,
4 months ago
Hindi,
4 months ago
Social Sciences,
10 months ago
Science,
10 months ago