Program working sucessfully on personal pc with n number of diff test cases but failing on ide
@Kolhar_Prashant hey, there is problem in your approach,use this approach:
int maxSubArraySum( int a[], int size)
{
`` int max_so_far = a[0];
`` int curr_max = a[0];
``
`` for ( int i = 1; i < size; i++)
`` {
`` curr_max = max(a[i], curr_max+a[i]);
`` max_so_far = max(max_so_far, curr_max);
`` }
`` return max_so_far;
}
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.