Strongest fighter STL

Why teo testcases are giving TLE? Please help or any hint.

Because *max_element() works in O(k) that’s why . Here the constraints are high . You need to think of using a data structure like deque here .

Will you please elaborate a little more on how to use deque

I will tell you about a question just read it’s article on gfg … It will be more clear then.
Question is : print maximum of every k length subarray . Read about it at gfg. Because the methodology is little long and if explain it to you here You will get confused.

okay okay. Thank you.

Please rate your experience of your doubt resolution.