✅C++| O(n) | Very Easy Solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n<--------------\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F PLEASE UPVOTE \u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F--------------->\n# Code\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 */\n//<--------------\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F PLEASE UPVOTE \u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F--------------->\nclass Solution {\npublic:\n    ListNode* mergeNodes(ListNode* head) {\n        int sum=0;\n        ListNode* temp=head->next;\n        ListNode* ans = NULL;\n        ListNode* temp1 = ans;\n        while( temp!=NULL )\n        {\n            if( temp->val == 0 )\n            {\n                ListNode* newnode = new ListNode( sum );\n                if( ans == NULL )\n                {\n                    ans = newnode;\n                    temp1 = ans;\n                }\n                else\n                {\n                    temp1->next = newnode;\n                    temp1 = temp1->next;\n                }\n                sum = 0;\n            }\n            else\n            {\n                sum = sum + temp->val;\n            }\n            temp = temp->next;\n        }\n        return ans;\n    }\n};\n//<--------------\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F PLEASE UPVOTE \u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F\u2B06\uFE0F--------------->\n```
['C++']