c++ SC-O(1)
class Solution {\npublic:\n\n    ListNode mergeNodes(ListNode head) {\n        if(head->val==0){\n            head=head->next;\n        }\n        ListNode res=
class Solution {\npublic:\n\n    ListNode* mergeNodes(ListNode* head) {\n        if(head->val==0){\n            head=head->next;\n        }\n        ListNode* res=head;\n        ListNode* temp=head;\n        int sum=0;\n        \n        while(temp){\n            if(temp->val!=0){\n                sum+=temp->val;\n                temp=temp->next;\n            } \n            else{\n                res->val=sum;\n                res->next = temp->next;\n                temp = temp->next;\n                res = temp;\n                sum = 0;\n            }\n            \n        }\n        return head;\n    }\n};
['Linked List', 'C']