All testcases failed . But Why?

Hey @apoorvagupta1

int N =n;//N=n here
for(int i=0;i<n;i++)
{
cin>>a[i];
mp[a[i]]= i;
}
for(int i=n;i>0;i--){//i=n here 

if this resolves your query then please mark it as resolved :slight_smile:

Can you explain what your second line of code means like what is lt gt . And after editing my code with this it is showing error in compilation . Please tell its workingand why it is showing error

Hey @apoorvagupta1
I think there is some technical issue because there is no gt in my comments or something like that.
You only have to do 2 changes in ur earlier code

initialize N=n
And the loop which u were starting from 5 , u have to start it with N instead

Still cant pass all the test cases . Only 25/100 testaces passed.

Updated ur code and mentioned the changes in comments : https://ide.codingblocks.com/s/364573 :slight_smile: