Simple Java Pre-Order Solution
\nclass Solution {\n    public Node flatten(Node h) {\n        if (h == null) return h;\n        \n        Stack<Node> st = new Stack<>();\n        Node prev = 
```\nclass Solution {\n    public Node flatten(Node h) {\n        if (h == null) return h;\n        \n        Stack<Node> st = new Stack<>();\n        Node prev = null;\n        st.push(h);\n        while (!st.isEmpty()){\n            Node cur = st.pop();\n            if (prev != null) {\n                prev.next = cur;\n                cur.prev = prev;\n                prev.child = null;\n            }\n            if (cur.next != null) st.push(cur.next);\n            if (cur.child != null) st.push(cur.child);\n            prev = cur;\n        }\n        \n        return h;\n    }\n}\n```
[]