EURON showing wrong Answer

Hi,
question link- https://www.codechef.com/LRNDSA04/problems/EURON
this is my code- https://www.codechef.com/viewsolution/35707259
why it is wrong which test case it is failing?
i tried most of the test cases.
like -
3 3 3 3 3
1 2 3 4 5
5 4 3 2 1
5 4 2 4 1

can anyone plz tell me.

input is a set of integers. So cases like 3 3 3 3, dont need to be taken care of, all integers will be unique. I can’t really comprehend your “java” solution but i don’t think u need to use divide and conquer for this question.

Yes, i used divide and conquer. I dont know why it is giving wrong answer.

use long for ans variable…because for n=10^5 inversions is 4.9*10^9 > Integer.MAX_VALUE

1 Like

Thanks done!