Kaden's algorithm

If numbers are negative then initializing the current sum with zero. How it will work please explain.

Hi @amansinghania007
for negative numbers u can first run a loop and check if all the numbers are negative or not… if all are negative then return the least negative number. else perform normal kadane’s algorithm…
refer my code --> https://ide.codingblocks.com/s/640615

Hi @amansinghania007
I hope its clear now??

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.