Subarray max sum

Please dry run and check your code. It is not giving correct answer even for the sample test case. I can see that you have not initialized variable sum1. Correct that and check.

No I have initialized the variable

Initialize variable sum1 to 0. It is not initialized. After that, also dry run your code with the sample case.

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.