EASY CPP CODE || 0 ms, faster than 100.00%
\n/*\n// Definition for a Node.\nclass Node {\npublic:\n    int val;\n    Node* prev;\n    Node* next;\n    Node* child;\n};\n*/\n\nclass Solution {\npublic:\n 
```\n/*\n// Definition for a Node.\nclass Node {\npublic:\n    int val;\n    Node* prev;\n    Node* next;\n    Node* child;\n};\n*/\n\nclass Solution {\npublic:\n  \n    Node* flatten(Node* head ,  Node* tail = NULL) {\n        // to solve this question we will introduce tail to the list    \n        if ( !head ) return tail;        \n        \n        head -> next = flatten ( head -> child , flatten ( head -> next , tail));\n        \n        if ( head -> next ) head -> next -> prev = head ;\n        \n        head -> child = NULL;\n        \n        return head;\n    }\n};\n```
[]