my code is not working for all the test cases. I worked for all the test cases possible but can’t find it . so pls help me out
link :https://ide.codingblocks.com/s/177616
K window problem
Hi,
there are 2 minor errors
in for(; i < n ; i++){
while(!q.empty() && q.front()<= (i-k))
{
// q.pop_back(); —> do not popthe back element since we are checking for elements that have gone beyond our range of observation , we pop_front() so that those out of range index are removed
q.pop_front();
}
also
while(!q.empty() &&
a[i]>=a[q.back()]
)
{
q.pop_back();
}
GREATER THAN EQUAL (>=) sign has be applied
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.