5 ms·
The linear solution looks like it depends on the maximum subsequence being greater than zero. Is there a similar solution that can produce Integer results?
by DannoHung 16y ago
The linear solution looks like it depends on the maximum subsequence being greater than zero. Is there a similar solution that can produce Integer results?
- aidenn0 16y agoWell it's linear time to find the maximum element of a sequence (which is equal to the maximum subsequence when all are non-positive), so you can by definition do both in linear time.