recursive java solution, beats 100%
\nclass Solution {\n    public Node flatten(Node head) {\n        if(head == null) return null;\n        recursiveHelper(head);\n        return head;\n    }\n  
```\nclass Solution {\n    public Node flatten(Node head) {\n        if(head == null) return null;\n        recursiveHelper(head);\n        return head;\n    }\n    \n    private Node recursiveHelper(Node head){\n        Node tmp = head.next;\n        if(head.child != null){\n            head.next = head.child;\n            head.child.prev = head;\n            Node last = recursiveHelper(head.child);\n            head.child = null;\n            if(tmp == null) return last;\n            last.next = tmp;\n            tmp.prev = last;\n        }\n        if(tmp == null)\n           return head; \n        return recursiveHelper(tmp);  \n    }\n}\n```
[]