Maximum subarray sum wrong output

Code -> https://ide.codingblocks.com/s/34262
Question -> https://hack.codingblocks.com/contests/c/509/1259
I used kadane’s algo and its working fine on ide and sublime ide. . . .but shows wrong output in question ide block.

https://ide.codingblocks.com/s/34291

I’ve made changes in your code.
Changed int to long long as constraints are big, and initialized variables for each test case.

Thanks now its working fine :sweat_smile:

@mukulgr81
Welcome bro…
Try to debug your code to find the errors. That would improve your coding skills also.

1 Like