Maximum subarray sum

I am not able to use test cases yet . https://ide.codingblocks.com/s/220671
please help

@purnima11 you were giving wrong input and why is the condition for while loop for test cases set for t<=20 without any updation? it will end up in an infinite loop this way. https://ide.codingblocks.com/s/220673

it fails all the test cases although the compiled answer is correct .

@purnima11 print answer for each test case in a separate line

I have tried that …it still shows test case failed

@purnima11 your array size is not big enough according to constraints. (best to use dynamic memory allocation) Also sum can be quite large so take long long int as datatype for all the variables.

I have tried using long long int …it still shows failed test cases !!!

@purnima11 did you change the arrays size as well? If it is still not passing then please share the code with all the changes and I will have a look.

1 Like

I did it …it runs now perfectly …thank you

1 Like

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.