Greatest subsequential sum: Difference between revisions

Line 1,262:
end
end
</lang>
 
#aA better answer would run in O(n) instead of O(n^2) using numerical properties to remove the need for the inner loop.
# numerical properties to remove the need for an inner loop.
 
<lang ruby>
# the trick is that at any point
# in the iteration if starting a new chain is
Anonymous user