Help me in this problem

i am getting wa


sliding +map approach

@Kartik011 are u there?

Hey @shivammishra20121999
Sorry was busy with some other doubt :slight_smile:
Let me check

Here updated ur code : https://ide.codingblocks.com/s/360518

@Kartikkhariwal1 why you remove second while loop?

u can use that as well but u have to add if condition in it anyway so thatswhy removed the loop :slight_smile:

@Kartikkhariwal1 it is giving wa

@Kartikkhariwal1 are u there

Hey @shivammishra20121999
Will look into it in some time , u have to keep patience :slight_smile:

@Kartikkhariwal1 okay let have a look now it is already 40 minutes has been paased

Okay I will

Hey @shivammishra20121999

                m[start]--;//added this

                if(m[start]==0)//added constraint

                count=count-1;

                start++; //changed order here 

Do this order,earlier i was checking for condition after incrementing start  which was a mistake

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

@Kartikkhariwal1 in last if block inside while loop you are not incrementing m[ar[j]]++;
why ?

Hey @shivammishra20121999
Yes we will do that there too .
I missed it thanks for telling me :slight_smile:

@Kartikkhariwal1 then how it passed bro :grinning: :grinning:

Sometimes testcases are weak thats why :sweat_smile:

@Kartikkhariwal1 every compiler should be like this only no tension of logic :crazy_face:

1 Like

It does not depend on the compiler ,it depends on the testcase :slight_smile:

@Kartikkhariwal1 i try to say that only sorry typing mistake

1 Like