Why this Question is giving error?

Why this Question is giving an error?

Please help, And I am attaching the Question in images

This One
Please help Please Zoom for Image

Hey @cbcao263
Please share link to the question
I checked its not visible to me that means its of ongoing Contest or something .
So I can’t help u with it until contest is over
Once its publicly visible I will help u with it :slight_smile:

It’s not of any Ongoing Contest,
It’s my college Assignment which I am not able to solve, That’s why I asked this One.

Okay u have missed implementing 2a i guess

Thanks a lot.
Now According to my I/P Elements in Queue should be 1,1,7
But that are 1,2,3,4,5,6
And Stack is working fine.
Why it is so?

Hey @cbcao263
Line 59

           if(xd1>=no)//>= here

Line 96–98

// for (auto i = q.front(); i != q.back(); i++) {
    //     cout << i << " ";
 // } 
    while(!q.empty()){
        cout << q.front() <<" ";
        q.pop();
    }

Bhaisaab LOLOL
Print kya krna tha Aur mein kya krrha tha
Sorry bro

1 Like

Thanks a lot bro
Thode bhut O/P mein error the
Wo mene theek krdiye the
40/100 aagya
ND fir dekha sabke hi 40 aaye.
Sochta hu kuch aur
Shyd Question mein hi prblm ho

U are getting WA or TLE in the rest ?

1 Like


TLE

Yeah because in this type of question where algo is written
One has to implement the same thing in optimised approach

So thats why u are getting TLE
So understand what is actually happening by this algo and then write ur own to efficiently do the same

1 Like

You dont have to necesarilly use queue and stack , u just have to reach to same output

1 Like

OMG
I can even solve it without Stack and QUEUE O.O :astonished: :astonished:

Sure bro
Lemme try this one too without Stack and Queues.

Bhai Wo Question hi galt tha
Thoda change krdiya tha uske baad teacher ne

Usko change kiya
Fir bhut ka 60 hogya but mera 40 hi aarha

Condition 1 update krdi
Question bhejrha hu yhi

Hey @cbcao263
Change your code accordingly
Its just implementation
After applying the same u don’t get the result then let me know
Right now 2.c.i is not implemented correctly

1 Like

Hmmm Bhai
Smjh gya tha

Thanks a lot for helping.
Bhut acha smjhaadiya

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.