I'm trying to answer this test from Geeks for Geeks to count the number of inversions some array need to be sorted. I know my code works but they need me to optimize my code in order to post it. The register keyword was something I implemented, but it still doesn't work... Could you guys help me, please?
// Your Code Here
register int i, j, cont = 0;
for(i = 0; i < N; i++) {
j = i + 1;
while(j < N) {
if(arr[i] > arr[j] && i < j) {
cont++;
}
j++;
}
}
return cont;