Greatest subsequential sum: Difference between revisions

m
Line 95:
script go
on |λ|(ab, x)
set a to |1| of fst(ab)
set {m1, m2} to {|1| of fst(a), |2| of snd(a)}
set high to max(Tuple(0, {}), Tuple(m1 + x, m2 & {x}))
Tuple(high, max(|2| of snd(ab), high))
end |λ|
end script
9,659

edits