Maximum Subarray Sum

i am trying to do this problem using Kadane’s method.
it showing correct answer for all my custom inputs but showing “run-error” in all test cases.

Hi @AlphaX
This question has to be solved by kadane’s method only. Kindly share your code ide so that i can have a look.

https://ide.codingblocks.com/s/169752 this is my code in case it is not visible

Hi @AlphaX
You are facing run error because size of array can be greater than 20 so make a[20] as a[n]. As it is given in the question that 1 <= N <= 100000. Do this change then all your test cases will pass.

Here is your corrected code :

Mark the doubt as resolved if it is 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.

soory for the wrong feedback…

my brother uses it and talked to you in comments

@AlphaX If u could tell me what issue are you exactly facing.
I`ll be able to guide u better.

If it kadanes code that is giving problem?
Here is a simple KADANE`s code

In case u have problem understanding do ping me.