This code works perfectly in my offline IDE but is showing run time error in coding blocks ide.
https://ide.codingblocks.com/s/70806
Runtime error in code!
n can be 10^5 and u have taken array size 100 thats why its is showing run error
1 Like
HI Ankush, your code is giving weird output for the given question. This is because the n i.e. size of array can go up to 100000 but in main you have fixed the size of array to 100 so it is giving runtime error at case where n > 100.
But for small cases even i.e. n <= 100 ( let’s consider the given sample testcase itself), the answer is INCORRECT and it is because something is missing in your kadanealgo function( Check what you are doing with variable cs)
Hope this helps
Good, pls mark it as resolved. If you still have any doubt you can ask.