Skip to main content
11 events
when toggle format what by license comment
May 2, 2016 at 7:54 comment added coderodde @SmartHome Yes. "Use-case" is the keyword here.
May 2, 2016 at 6:07 comment added Smart Home Thanks, accepted the answer. I guess how to deal with all -ve will depend on use-case. In the case of interview, best approach is to ask the interviewer!
May 2, 2016 at 6:06 vote accept Smart Home
May 2, 2016 at 5:14 comment added coderodde @SmartHome On the second thought, if all the integers in the array are negative, you could think that an empty subarray (with the value of 0) is the maximum subarray. What would be your opinion on that issue?
May 2, 2016 at 5:12 history edited coderodde CC BY-SA 3.0
edited body
May 2, 2016 at 5:10 comment added coderodde @SmartHome Overlooked that, thanks! Updated the code.
May 2, 2016 at 5:06 comment added Smart Home To make it work for the case where all numbers in array are -ve, change the maximum_end = MAX(maximum_end + x, 0); with maximum_end = MAX(maximum_end + x, x);
May 1, 2016 at 22:33 comment added Smart Home Does not work if all numbers in array are negative.
May 1, 2016 at 18:48 history edited coderodde CC BY-SA 3.0
edited body
May 1, 2016 at 18:04 history edited coderodde CC BY-SA 3.0
added 14 characters in body
May 1, 2016 at 9:34 history answered coderodde CC BY-SA 3.0