private static LeetCode114TreeNode Helper(LeetCode114TreeNode root)
        {
            if (root == null)
            {
                return(null);
            }
            if (root.IsLeaf())
            {
                return(root);
            }

            var left  = Helper(root.left);
            var right = Helper(root.right);

            if (left != null)
            {
                left.right = root.right;
                root.right = root.left;
                root.left  = null;
            }

            return(right == null ? left : right);
        }