Whats wrong with this approach

i have created a window and have selected max elem in that window and moved forward
code:https://ide.codingblocks.com/s/264085

hello @bhaskar0_0
i think ur approach is correct,
what issue u r facing

it is giving wrong answer to all the test cases.I checked for the sample test case and it gave the correct ans

i will try to debug ur code.
for now u can refer this easy implementation - > https://ide.codingblocks.com/s/264406

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.

did you manage to debug the code?

What is the problem that you are facing?

I couldn’t understand what’s wrong with my code.You said that you will try to debug it.I understood the other code you sent.

I am not the one who checked your code before. It was @aman212yadav maybe he helped you with the approach

yeah bro i was taking his doubt, but was not able to debug his code.
and thats why he reopend the doubt.

@amankumarkeshu oh sorry.i didn’t see.Anyway can you debug the code.Its giving WA

Can you send me your updated code so that I can check it

@amankumarkeshu it is the same code,I didn’t update it.https://ide.codingblocks.com/s/264085?_ga=2.164688511.193502328.1593315055-1770060536.1574522827

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.