Simple Java solution without recursion faster than 100% and memory less than 99%
\nclass Solution {\n    public Node flatten(Node head) {\n        Node curr=head;\n        while(curr!=null){\n            if(curr.child != null){\n            
```\nclass Solution {\n    public Node flatten(Node head) {\n        Node curr=head;\n        while(curr!=null){\n            if(curr.child != null){\n                Node tail = findTail(curr.child);\n                if(curr.next != null){\n                    curr.next.prev=tail;\n                }\n                \n                tail.next = curr.next;\n                curr.next =curr.child;\n                curr.child.prev = curr;\n                curr.child =null;\n            }\n            curr = curr.next;\n        }\n        return head;\n    }\n    \n    public Node findTail(Node child){\n        while(child.next != null){\n            child=child.next;\n        }\n        return child;\n    }\n}\n```
['Java']