CPP icon indicating copy to clipboard operation
CPP copied to clipboard

Count Inversion Problem

Open UtkarshChaurasia opened this issue 4 years ago • 3 comments

Inversion Count : For an array, inversion count indicates how far (or close) the array is from being sorted. If array is already sorted then inversion count is 0. If array is sorted in reverse order that inversion count is the maximum. Formally, two elements a[i] and a[j] form an inversion if a[i] > a[j] and i < j. 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: Print the inversion count of array. Constraints: 1 ≤ T ≤ 100 1 ≤ N ≤ 107 1 ≤ C ≤ 1018 Example: Input: 1 5 2 4 1 3 5 Output: 3

UtkarshChaurasia avatar Sep 30 '20 19:09 UtkarshChaurasia

I would like to solve this problem, please help me with getting started

Sambhu98 avatar Sep 30 '20 19:09 Sambhu98

@akshitagupta15june I want to work on this issue as a part of Hacktoberfest.

UtkarshChaurasia avatar Sep 30 '20 19:09 UtkarshChaurasia

I would like to solve this problem, please help me with getting started

I have opened this issue for myself. You can open up an issue and work on that. Cheers

UtkarshChaurasia avatar Sep 30 '20 19:09 UtkarshChaurasia