Can anyone help me solve this question

Can anyone pls help me solve Q3 in the given document
https://1drv.ms/b/s!Al9xIYmMuIkqiDdWAcp0ddaFYJFF?e=fJkBBz

i think dequeue can be implemented here but am not getting the logic…

https://1drv.ms/b/s!Al9xIYmMuIkqiDdWAcp0ddaFYJFF?e=fJkBBz

You want me to write the code? Because the logic is explained in the 2 paras written below, i.e., you maintain a queue of finish times , and whenever a new element comes ,pop those elements whose finish time was less, so that the buffer size is again maximised. If there is space then insert the element, otherwise drop it.

it would be good if u write the code…:slight_smile:


I have tried the code here…pls check

Thanks in advance…:slight_smile:

Okay I’ll write a simpler implementation. Please Wait.

1 Like

i think some error is there in the else part…

thnx…

Okay this https://ide.codingblocks.com/s/245438 this passes the sample test cases.

its not giving any o/p…getting sigsegv

Please try this https://ide.codingblocks.com/s/245449

yea sure i am trying…

still am getting the same sigsegv…lets debug

Is it giving sigsegv for sample? The new code which I sent?

yeah its giving sigsegv for the sample

It shouldn’t ,please click on the new code its running fine on the hackerblocks ide.

yeah its running…net problem sorry…

Okay if you don’t have any further doubts please mark this as resolved.