-
From Joshua Harris in python (gist)
-
From Denis Karpenko in Ruby (with rspec tests!) (gist)
-
From Nikki DelRosso in python (gist):
"And an explanation of the solution (since the Python is very dense): For each value, since we're doing sums consecutively, we want to calculate the maximum that we could attain if we use the current value as the last value in the sequence. The only information we need to calculate this was what the maximum value was if we ended on the value before this in the sequence. If the previous value was negative, then the max value attainable by ending on this value is just this value. Otherwise, we add the current with the value for the previous element. All we need, then, is to iterate through our sequence and keep track of the previous best option, as well as the maximu