public static TreeNode UpsideDownBinaryTree(TreeNode root) {
        if(root == null || root.left == null) return root;

        TreeNode leftRoot = UpsideDownBinaryTree(root.left);
        TreeNode node = leftRoot;
        while(node.right != null){
            node = node.right;
        }

        node.left = root.right;
        node.right = root;
        root.left = null;
        root.right = null;
        return leftRoot;
    }