Simple solution using stack || C++
Please upvote if  you like my solution .\n\nclass Solution {\npublic:\n    Node* flatten(Node* head) {\n        stack<Node*> st;\n        if(head == NULL) retur
Please upvote if  you like my solution .\n```\nclass Solution {\npublic:\n    Node* flatten(Node* head) {\n        stack<Node*> st;\n        if(head == NULL) return head;\n        Node* ptr = head;\n        \n        while(ptr->next != NULL || ptr->child != NULL){\n            if(ptr->child != NULL){\n                st.push(ptr->next);\n                ptr->next = ptr->child;\n                ptr->child->prev = ptr;\n                ptr->child = NULL;\n            }\n            ptr = ptr->next;\n        }\n        while(!st.empty()){\n            Node* t = st.top(); st.pop();\n            if(t != NULL){\n                ptr->next = t;\n                t->prev = ptr;\n                while(t->next != NULL) t = t->next;\n                ptr = t;\n            }\n        }\n        return head;\n    }\n};\n```
['Stack', 'C', 'Iterator']