Rohit Singhal
1 min readSep 6, 2019

--

Hii… Thanks for pointing out…

However, the task here is to find a contiguous subarray… So even if the input has all negatives (eg. [-4, -1, -9]), I want to return the contiguous subarray with max sum (-1 in this case). Basically, not choosing a subarray at all is not an option we have…

--

--