If I use the kadane’s algo to solve this question then there would be one possible case where this would not work
i.e. when the elements of the array are negative.
In this case the sum by kadanes algo would always be zero.
Cpp max subarray sum
Hey @Kush_1312 if you were to initialize max_sum_so_far with - INT_MAX, the answer wouldnt be zero anymore.
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.