Java easy Solution || Easy-to-understand ||beat 90%
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nTake loop for iteration
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nTake loop for iteration .While iterating increment the count variable when your pointer points to 0. When you find two consecutive zero\'s add the inbetween node val in sum variable. At last add your sum into new ListNode and return it.\n\n# Complexity\n- Time complexity:\n**O(N)**\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n  **O(N)**\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\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 ans=new ListNode();\n        ListNode temp=ans;\n        ListNode curr=head;\n        int sum=0;\n        int count=0;\n        while(curr!=null){\n            if(curr.val==0) count++;\n                 else sum+=curr.val;\n\n            if(count==2){\n                ListNode node=new ListNode(sum);\n                ans.next=node;\n                ans=ans.next;\n                sum=0;\n                count=1;\n            }\n            curr=curr.next;\n        }\n        return temp.next;\n    }\n}\n```
['Linked List', 'Two Pointers', 'Java']