Maximum subarray sum


my code is showing segmentation fault.Please help.

@srshubhi398 segmentation fault becoz size too big
but your logic also seems wrong

What is wrong with my logic??And I took long long int so why is size so big??

@srshubhi398 static array cant store that much size (at max 1e6)
kadane algo should be used in it


I used it.please check.

@srshubhi398 corrected and commented


dont forget to hit like and mark resolved if cleared :smiley:

1 Like

Thankyou so much :slightly_smiling_face:.I guess my only mistake was that I returned the value in the main function but did not print it out.Am I right?? :neutral_face:

@srshubhi398 yes and too much large size

1 Like