I am not able to understand why we put if condition for curr_sum when curr_sum is less than zero we make curr_sum=0?
Kadane's Algorithm
because if the curr_sum becomes less than 0, then we already have a sub array which is better than that (taking no element at all). Hence sub array sum to be 0 is the base case, if anything goes below that, set it to 0.