in kadane’s algo whenever current sum becomes negative we assign 0 value to current sum …what if all the values are negative then according to algo the max sum will be 0 which will be wrong
For all negative inputs in kadane's algo
@7damul, In that case, kadane algorithm will also work but there will be small modification you can refer to this link
kadane algo for negative numbers.
1 Like
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.