3
$\begingroup$

Does anyone know of an algorithm that finds contiguous sublists of a list with positive sum? Preferably in O(n). I'm more interesting in the max length of those lists.

Thank you in advance.

  • 0
    If you constrain your sublist to either start or end on a non-negative number, it is quite easy to do in linear time. However, I don't see how to generalize this.2012-11-17
  • 0
    That's much more better than the O(n^2) algorithm I have now. Can you be more specific? If the list starts with a non-negative integer how will you proceed?2012-11-18

1 Answers 1