Easy JAVA approach!!!
Intuition\n Describe your first thoughts on how to solve this problem. \nMust be an easy rated problem\n\n# Approach\n Describe your approach to solving the pro
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nMust be an easy rated problem\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nAdding nodes util zero th node is reached and add it to the resultant linked list and finally return the list.\n\n# Complexity\n- Time complexity: 5ms\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\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        \n        ListNode temp=head.next;\n        ListNode res=new ListNode(0);\n        ListNode curr=res;\n        int sum=0;\n        while(temp!=null){\n            if(temp.val==0 && sum>0){\n                curr.next=new ListNode(sum);\n                curr=curr.next;\n                sum=0;\n            }\n            else{\n            sum+=temp.val;}\n            temp=temp.next;\n\n        \n        }\n    return res.next;\n    }\n}\n```
['Linked List', 'Simulation', 'Java']