Merge Nodes in Between...
Intuition\n Describe your first thoughts on how to solve this problem. \nAs it is given that the two zeroes cannot be together and thus it gives an intuition th
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nAs it is given that the two zeroes cannot be together and thus it gives an intuition that the possibly we have to find the sum so far and then reintilialize the sum back to zero and traverse till the node becomes None.\n# Approach\n<!-- Describe your approach to solving the problem. -->\nCreate a dummy node and then point the cur to the head of the given linked list..then when the cur.val becomes zero then make sum to zero and assign the so far sum to the created node and contiue tha pattern..\n\n    For further details walk through the code........\n\n# Code\n```\n# Definition for singly-linked list.\n# class ListNode:\n#     def __init__(self, val=0, next=None):\n#         self.val = val\n#         self.next = next\nclass Solution:\n    def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]:\n        dummy=ListNode(0)\n        ptr=dummy\n        cur=head.next\n        s=0\n        while cur:\n            while cur.val!=0:\n                s=s+cur.val\n                cur=cur.next\n            ptr.next=ListNode(s)\n            #pointing the so far sum to the linked list element...\n            ptr=ptr.next\n            cur=cur.next\n            s=0\n        return dummy.next\n```
['Python3']