Maximum subarray sum

code is showing runtime error for test case but working fine for sample input, please rectify

Hi Basant, your code is fine.
But, in the coding world, we use some things for the sake of good practice.
In your code, if test cases are more than one, your array is initializing again & again which is not good.
I commented on something & updated your code. Please have a look.

If you have any other doubts, please feel free to ask.

1 Like

thanks! its working now