Problem in Strongest Fighter Question

I think my code is working perfect but some test cases are failing. Don’t know where it is going wrong.

Please share your code via CB IDE.

Here is my solution: http://cpp.sh/7lm4l

Don’t know why, but CB IDE wasn’t able to generate link, so I used another one.

Hey @prasang.singhal
Your approach is incorrect. It is a sliding window problem approach. You need to maintain a deque.
See this https://www.geeksforgeeks.org/sliding-window-maximum-maximum-of-all-subarrays-of-size-k/

If your doubt is resolved please mark it as closed.

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.