Python solution with explanation
The Idea\n\t\nWe will process the list "depth first" (i.e. to the lowest child), redirecting parent nodes next pointers to their children, and saving the previo
## The Idea\n\t\nWe will process the list "depth first" (i.e. to the lowest child), redirecting parent nodes next pointers to their children, and saving the previous values of their next pointers in a Stack to be reattached once the bottom-most non-parent node has no siblings. \n\n## The algorithm\n### Pseudocode\n1. Initialize a current reference to the head of the list and an empty stack\n2. If our current reference is a Node, then see if it has a child. \n\t* (case 1) If it does have a child, then push its next reference (if it has one) to the top of the Stack. Then, reset the next reference of the current reference and the current\'s child reference appropriately. After this operation, the current reference should have lost a child reference, but have their next reference pointing to the former child. \n\t* (case 2) If it does not have a child, then, if it lacks a next reference and there are references left in the Stack, then reassign its next reference and the current top of the Stack appropriately. After this operation, the next reference of the current reference should be the top of the Stack, and the top of the Stack\'s previous reference should be the current reference. \n3. Advance the current reference forward to its next reference. \n4. Repeat 2 and 3 until the current reference is None. \n\n### Example\nSay we have the following list:\n```\n(head)\n [1] --> [2] --> [5] \n          \\--> [3]\n```\t\t\t\t\t\n\n1 current = [1]; stack = []\n2a. N/A\n3a. Since current has lacks a child and has a next pointer, simply advance it (i.e. current = [2])\n2b. Since current has a child, save [5] to the top of the stack, and set the list to be the following:\n```\n[1] --> [2] --> [3]\n```\n3b. Advance current to its next pointer (i.e. current = [3])\n2c. Since current lacks a next pointer, and the stack is non-empty (i.e. it contains [5]), then set the list to be the following:\n```\n[1] --> [2] --> [3] --> [5]\n```\n3c. Advance the current to its next pointer (i.e. current = [5]). \n2d. N/A\n3d. Advance the current to its next pointer (i.e. None). \n4. Since current is None, stop. \n\n## The Code\n\n```\nclass Solution(object):\n    def flatten(self, head):\n        # Initialize the current reference and stack of saved next pointers\n        curr, tempStack = head, [];\n        while curr:\n            if curr.child:\n                # If the current node is a parent\n                if curr.next:\n                    # Save the current node\'s old next pointer for future reattachment\n                    tempStack.append(curr.next);\n                # Current <-> Current.child\n                #   \\-> None\n                curr.next, curr.child.prev, curr.child = curr.child, curr, None;\n            if not curr.next and len(tempStack):\n                # If the current node is a child without a next pointer\n                temp = tempStack.pop();\n                # Current <-> Temp\n                temp.prev, curr.next = curr, temp;\n            curr = curr.next;\n        return head;
[]