Beautiful Towers II
Maximise the same capped mountain-shaped total as a faster version, avoiding a rebuild for every peak. The visual sweeps left and right with monotonic stacks that record how far each height can extend.
Maximise the same capped mountain-shaped total as a faster version, avoiding a rebuild for every peak. The visual sweeps left and right with monotonic stacks that record how far each height can extend.