Free written solution

Remove Zero Sum Consecutive Nodes from Linked List (LeetCode 1171): Solution and Explanation

Repeatedly delete runs of consecutive nodes whose values sum to 0 until none remain, and return the head of the final list.

Read the intuition, approach, code and complexity →