Getting wa on submission but test case runs manually C++


Comment body goes here.

int Solution::solve(vector &A)
int i,n=A.size();
return 1;
return -1;


Take the below test case to understand the wrong approach.

Your code will return 1 because when it will be checking index 3 it will get true and return 1.
But it should return -1 actually.Check the question .It asked for the number of elements greater than the current element and not the number of elements greater or equal to the current element.You are making a mistake by takiing the equal elements also in your count for checking the truth of the problem.

Hope you understood the explanation.