Not passing test case

1,-1,5,3,-2,1,1,1 according to the code output of this will be 2 but actually the answer is 5 (k=4).

Hello @Ayushmahajan513
1,-1,5,3,-2,1,1,1

consider this part of the array 3,-2,1,1,1 it has sum 4 and length 5
so 5 is the correct answer

but the code is giving 2 as a output

yeah the code implementation shown inn video is bit wrong.

refer this link

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.