Without recurssion c++ easy peasy solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\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:\nNode* a=new Node(0);\n\n    Node* flatten(Node* head) {\n        Node* temp= head;\n        stack<Node*> st;\n     while(head){\n          if(head->child){\n              if(head->next)st.push(head->next);\n              head->next=head->child;\n              head->next->prev=head;\n              head->child=NULL;\n          }else if(head->next==NULL&& !st.empty()){\n                head->next=st.top();\n                st.pop();\n                head->next->prev=head;\n          }\n       head=head->next;\n     }\n     return temp;\n    }\n};\n```
['C++']