C++ Easy Recursive Solution
```\nclass Solution {\npublic:\n    Node flatten(Node head) {\n        if(!head)   return head;\n        Node curr=head;\n        while(curr)\n        {\n      
```\nclass Solution {\npublic:\n    Node* flatten(Node* head) {\n        if(!head)   return head;\n        Node* curr=head;\n        while(curr)\n        {\n            if(curr->child)\n            {\n                Node* temp = curr->next;\n                Node* x = flatten(curr->child);\n                x->prev= curr;\n                curr->next = x;\n                Node* end = x;\n                while(end->next)\n                    end=end->next;\n                end->next = temp;\n                if(temp)\n                    temp->prev = end;\n                curr->child = NULL;\n            }\n            curr=curr->next;\n        }\n        return head;\n    }\n};
[]