You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the array contains all non-negative numbers, then the problem is trivial; a maximum subarray is the entire array.
If the array contains all non-positive numbers, then a solution is any subarray of size 1 containing the maximal value of the array (or the empty subarray, if it is permitted).
Several different sub-arrays may have the same maximum sum.
The second property is broken, array containing only negative numbers returns 0, instead of correct result. There is a leetcode task that also assumes compliance with this rule.
The text was updated successfully, but these errors were encountered:
funnydman
changed the title
Wrong definition of "Maximum subarray problem"
Update definition of "Maximum subarray problem"
Dec 13, 2020
Maximum subarray problem is a well known problem and has specified properties, e.g.
The second property is broken, array containing only negative numbers returns 0, instead of correct result. There is a leetcode task that also assumes compliance with this rule.
The text was updated successfully, but these errors were encountered: