sir jab array 0,-1 ,1 ,2 ,5, -5 hoga naa tab
csum array=0,-1,0,2,7,2 aur is m do sabse bad array honga
jo same no se start ho raha hai wohi mere subarray honga
magarsir jab mai 5,-5 wala subarray hoga sum=0
magar jab mai cummulative subarray ki tarah se dekhonga toh ushka hisaaab se 2,5,-5 bhi include hogaa.
which is wrong
Length of longest sub array with sum=0(heap)
hello @YASHMATHURIA123
nahi 2 include nahi hoga.
kunki csum array mein agar ek value index j pe hai aur same value index i pe bhi hai then jo length hogi array ki wo
i-j hogi ( note j th index is not included)
yaga 2 index -> 3 aur 5 pe aa raha hai
to jo length hogi wo 5-3 => 2 hogi aur jo array hoga wo
start hoga index 4 se end hoga index 5 pe