✅✅✅ C++ easily Understandable Code
We are traversing the whole list and if any 0 encountered then we simply add in our newly generated Linked List i.e. ptr\nWe add a condition sum>0 that is only 
We are traversing the whole list and if any 0 encountered then we simply add in our newly generated Linked List i.e. ptr\nWe add a condition sum>0 that is only for first element\n\n\n```\n/**\n * Definition for singly-linked list.\n * struct ListNode {\n *     int val;\n *     ListNode *next;\n *     ListNode() : val(0), next(nullptr) {}\n *     ListNode(int x) : val(x), next(nullptr) {}\n *     ListNode(int x, ListNode *next) : val(x), next(next) {}\n * };\n */\nclass Solution {\npublic:\n    ListNode* mergeNodes(ListNode* head) {\n        \n        ListNode*ptr=new ListNode();\n        ListNode*p=ptr;\n        \n        int temp=0,sum=0;\n        \n        while(head){\n            \n            if(head->val==0){\n                sum=temp;\n                \n                if(sum>0){\n                    ptr->next=new ListNode(sum);\n                    ptr=ptr->next;\n                }\n                \n                temp=0;\n            }\n            \n            else{\n                temp+=head->val;\n            }\n            \n            head=head->next;\n        }\n        \n        return p->next;\n    }\n};\n```
['Linked List', 'C']