SIMPLE-DIMPLE .
\n\n# Code\n\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListN
\n\n# Code\n```\n/**\n * Definition for singly-linked list.\n * public class ListNode {\n *     int val;\n *     ListNode next;\n *     ListNode() {}\n *     ListNode(int val) { this.val = val; }\n *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }\n * }\n */\nclass Solution {\n    public ListNode mergeNodes(ListNode head) {\n        ListNode temp=head;\n        ListNode ans=new ListNode(-1);\n        ListNode iterator=ans;\n        while(temp!=null){\n            int sum=0;\n            while(temp.val!=0){\n                sum+=temp.val;\n                temp=temp.next;\n            }\n            if (sum>0){\n                iterator.next=new ListNode(sum);\n                iterator=iterator.next;\n            }\n            temp=temp.next;\n        }\n        return ans.next;\n    }\n}\n```
['Linked List', 'Simulation', 'Java']