Python simple solution beats 100% || Explained
\n# Code\n\n\nclass Solution(object):\n    def flatten(self, head):\n        if not head:\n            return head\n        current_node = head\n        while c
\n# Code\n```\n\nclass Solution(object):\n    def flatten(self, head):\n        if not head:\n            return head\n        current_node = head\n        while current_node != None:\n            if current_node.child == None:\n                current_node = current_node.next\n            else:\n                tail_child = current_node.child\n                while tail_child.next != None:\n                    tail_child = tail_child.next\n                tail_child.next = current_node.next\n                if tail_child.next != None:\n                    tail_child.next.prev = tail_child\n                current_node.next = current_node.child\n                current_node.next.prev = current_node\n                current_node.child = None\n        return head\n```\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n
['Linked List', 'Doubly-Linked List', 'Python']