Python solution, Easy Understanding without using stack
\nclass Solution:\n    def flatten(self, head: \'Optional[Node]\') -> \'Optional[Node]\':\n        if head is None:\n            return\n        c = head\n     
```\nclass Solution:\n    def flatten(self, head: \'Optional[Node]\') -> \'Optional[Node]\':\n        if head is None:\n            return\n        c = head\n        while c:\n            if c.child is not None:\n                ch = c.child\n                ch.prev = c\n                t = c.next\n                c.next = c.child\n                c.child = None\n                if t is not None:\n                    while ch.next:\n                        ch = ch.next\n                    t.prev = ch \n                    ch.next = t\n            c = c.next\n        return head\n```\n\nIf you like this solution upvote
['Linked List', 'Python']