Let’s say there is just one element in an array [-5] then the max sum should be -5 but this code will return 0. Am I right?
Then in this case, if the max sum of the subarray is negative it won’t work.
Let’s say there is just one element in an array [-5] then the max sum should be -5 but this code will return 0. Am I right?
Then in this case, if the max sum of the subarray is negative it won’t work.