C++, Concise solution | Beats 98.6%
void func(Node head, Node q) {\n        \n        if(!head) return;\n        \n        func(head->next, q);\n        if(q && !head->next)\n        {\n          
void func(Node* head, Node* q) {\n        \n        if(!head) return;\n        \n        func(head->next, q);\n        if(q && !head->next)\n        {\n            head->next=q;\n            q->prev = head;\n        }\n            \n        \n        if(head->child)\n        {\n            Node* temp = head->next;\n            func(head->child, temp);\n            head->next = head->child;\n            head->child->prev = head;\n            head->child=NULL;\n        }\n        \n        return;\n    }\n    \n    Node* flatten(Node* head) {\n        \n        if(head)\n            func(head, NULL);\n        \n        return head;\n    }
['C++']