About the longest subarray sum

if(pre==0) len=max(len, i+1) I did not understand the meaning and use of this line

It means that whenever you see a 0 in the prefix sum array(cumulative sum array)…it actually means that the subarray starting from index 0 to index i has a sum of 0. This can also be a possible answer…so len=max(len,i+1)

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.