Unnecessary if condition

I want to know is it necessary to take the first if condition where if arr[i]==0 and len == 0 then we make len= 1

nhi i feel it is one of the base condition
suppose the array has elements
0 1 3 -3 -1 0 2
then
a single element with value 0 would be considered as subarray with sum 0

yeh walli condition yaha useful h

iss point peh pre walla sum non zero ho sakta h

okay i think i got it

1 Like