7
3
1 0 3 1 1 1 9
for this test case, answer should be 3 but it is coming as 1.
Sir, output is coming different
Sir, but int the previous question in which we had to look for sum =0 and not k, we did not use this kind of condition
when we need to insert pre in map ?
we need to insert it if it is not available.
that is the reason we are checking if(m.find(pre)==m.end())
in last code also we were doing the same
if(pre is presnt in map ) then update length
otherwise
insert in map
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.