Unable to pass 3 test cases for the problem 1 Count

My cod is unable to pass 3 test cases for the problem 1 Count. I think my approach is correct and so I am unable to figure out what exactly am I doing wrong. Please help

My code : https://ide.codingblocks.com/s/460798

hello @Yash5646

if there are more than one longest subarray are possible then choose the one that is in the extream left .

I did try that but it is still failing the first test case.

Updated Code: https://ide.codingblocks.com/s/460798

try this case->
2 0
0 0

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.