I am not passing the first test case plz look into this…
1 Count Problem DP
@aryamaan1011, you are not handling the case when k=0 and all the element in the array are 0, since you have intialized left and right with 0 then in this case you will print (0-0+1) which is 1 but answer should be 0
eg:-
1 0
0
your ouput :-
1
0
correct output :-
0
0
corrected code :-
In case of any doubt feel free to ask 
Mark your doubt as RESOLVED if you got the answer