cnblogs/coder-service

使用metaweblog上传随笔后格式错误

Closed this issue · 5 comments

上传内容如下

给定一个二叉树,检查它是否是镜像对称的。

 

例如,二叉树 [1,2,2,3,4,4,3] 是对称的。

    1
   / \
  2   2
 / \ / \
3  4 4  3

 

但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:

    1
   / \
  2   2
   \   \
   3    3

 

进阶:

你可以运用递归和迭代两种方法解决这个问题吗?

C#代码

/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     public int val;
 *     public TreeNode left;
 *     public TreeNode right;
 *     public TreeNode(int x) { val = x; }
 * }
 */
public class Solution {
    public bool IsSymmetric(TreeNode root) {
        return IsSymmetric(root,root); 
    }
    public bool IsSymmetric(TreeNode p,TreeNode q) {
        if(p == null && q == null) return true;
        if(p == null || q == null) return false;
        if(p.val != q.val) return false;
        return IsSymmetric(p.right, q.left) && IsSymmetric(p.left, q.right);
    }
}

但在博客园管理后台显示格式

给定一个二叉树,检查它是否是镜像对称的。

例如,二叉树 [1,2,2,3,4,4,3] 是对称的。

1

/
2 2
/ \ /
3 4 4 3

但是下面这个 [1,2,2,null,3,null,3] 则不是镜像对称的:

1

/
2 2
\
3 3

进阶:

你可以运用递归和迭代两种方法解决这个问题吗?

C#代码 /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNode left; * public TreeNode right; * public TreeNode(int x) { val = x; } * } */ public class Solution { public bool IsSymmetric(TreeNode root) { return IsSymmetric(root,root); } public bool IsSymmetric(TreeNode p,TreeNode q) { if(p == null && q == null) return true; if(p == null || q == null) return false; if(p.val != q.val) return false; return IsSymmetric(p.right, q.left) && IsSymmetric(p.left, q.right); } }

即传上去后代码格式错误。

您好,我这边是基于metaweblogmethod metaWeblog.newPost方法使用.NET C# xmlRPC实现。
xmlRPC接口封装

[XmlRpcMethod("metaWeblog.newPost")]
string NewPost(string blogid, string username, string password, Post post, bool publish);

调用代码

ICNBlogsInterface proxy = XmlRpcProxyGen.Create<ICNBlogsInterface>();
var addResult = proxy.NewPost(blogId, userName, password, new Post()
        {
            title = name,
            description = content,
            dateCreated = DateTime.Now,
            categories = categories
        }, false);

上传时设置了title、description、dateCreated、categories 四个字段值,其他字段均未设置。
故还请老师指教,哪里未处理对。

您好,如果博文内容用的是 markdown,需要在分类名称中传入[Markdown]

好的,我试试,谢谢。

我试了带上[Markdown]上传后的代码格式就正常了,非常感谢。