[Python 3] One pass straightforward solution
python3 []\nclass Solution:\n    def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        cur, sm, prev = head.next, 0, head\n        whil
```python3 []\nclass Solution:\n    def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        cur, sm, prev = head.next, 0, head\n        while cur:\n            sm += cur.val\n            if cur.val == 0:\n                cur.val, sm = sm, 0\n                prev.next = prev = cur\n            cur = cur.next\n\n        return head.next\n```\n```python3 []\nclass Solution:\n    def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        backbone = ListNode()\n        prefix, prev = 0, backbone\n        while head:\n            if head.val == 0:\n                if prefix > 0:\n                    prev.next = ListNode(prefix)\n                    prefix = 0\n                    prev = prev.next\n            else:\n                prefix += head.val\n            head = head.next\n\n        return backbone.next\n```\n
['Linked List', 'Python', 'Python3']