✅ One Line Solution
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1.1 - One Line\nTime complexity: O(n). S
(Disclaimer: this is not an example to follow in a real project - it is written for fun and training mostly)\n\n# Code #1.1 - One Line\nTime complexity: $$O(n)$$. Space complexity: $$O(n)$$.\n```\nclass Solution:\n    def mergeNodes(self, h: Optional[ListNode]) -> Optional[ListNode]:\n        return (f:=lambda w,n:n and (n.val and f(w+n.val,n.next) or ListNode(w,f(0,n.next))))(0,h.next)\n```\n\n# Code #1.2 - Unwrapped\n```\nclass Solution:\n    def mergeNodes(self, h: Optional[ListNode]) -> Optional[ListNode]:\n        def f(w, n):\n            if n:\n                if n.val:\n                    return f(w+n.val, n.next)\n\n                return ListNode(w, f(0, n.next))\n\n        return f(0, h.next)\n```\n\n<!--\n# Code #1.1 - One Line\n```\nclass Solution:\n    def mergeNodes(self, h: Optional[ListNode]) -> Optional[ListNode]:\n        return (f:=lambda w,n:n and (n.val and f(w+n.val,n.next) or ListNode(w,f(0,n.next))))(0,h.next)\n        return (f:=lambda w,n:n and (ListNode(w,q:=f((v:=n.val) and w+v,n.next)),q)[v>0])(0,h.next)\n\n        def f(w, n):\n            if n:\n                if n.val:\n                    return f(w+n.val, n.next)\n\n                return ListNode(w, f(0, n.next))\n\n        return f(0, h.next)\n```\n-->\n\n(Disclaimer 2: code above is just a product of fantasy packed into one line, it is not claimed to be \'true\' oneliners - please, remind about drawbacks only if you know how to make it better)
['Linked List', 'Recursion', 'Simulation', 'Python', 'Python3']