mgechev/javascript-algorithms

Maximum subarray O(n) solution incorrect

emyarod opened this issue · 0 comments

The current implementation will fail the following tests:

maxSubarray([]); // returns 0, should return `undefined`
maxSubarray([-42]); // returns 0, should return 42
maxSubArray([-10, -1, -2, -3, -1]); // returns 0, should return -1