How is this approach giving a right answer? like what i mean is that cummulative sum array at -1 index must have some garbage value [cum[i-1]] when i =0 cum[i-1]=garbage value , then how is it giving right answer
Sum subarray max
Hey @apoorv.chauhann
It depends compiler to compiler but in most of the cases it will have garbage value instead of 0
so is there any way like we can solve this method with the same approach??? or we have to go for Kadens ?
Whcih method?? ???
I mean this problem of finding maxsum using cummulative array?
This is the correct version of this approach : https://ide.codingblocks.com/s/352812?_ga=2.72519830.461343521.1600679879-601377077.1596122527
But most of the we use Kadane because its more efficient
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.