Problem 2181 · Medium

Merge Nodes in Between Zeros

Collapse each block of values between zero delimiters into one node holding the block's sum, and drop the delimiters. The visual walks the list and shows each block folding into a single sum.

Open the interactive visualisation