问题树洞

2019.3.24

java文件直接通过cmd javac命令编译出来的文件在javap反编译过程没有找到LocalVariableTable

而通过IDE编译出来的.class文件有这一项

 

2019.4.6

树是否对称

/*
public class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;

    public TreeNode(int val) {
        this.val = val;

    }

}
*/


public class Solution {
    static StringBuffer s = new StringBuffer();
	static StringBuffer s1 = new StringBuffer();
    
    private static void xuLieHua(TreeNode node) {
		
		if (node == null) {
			s.append("#_");
			return;
		}
        s.append(String.valueOf(node.val));
			s.append("_");
		xuLieHua(node.left);
		xuLieHua(node.right);
	}
	
	private static void faXuLieHua(TreeNode node) {
		
		if (node == null) {
			s1.append("#_");
			return;
		}
        s1.append(String.valueOf(node.val));
		s1.append("_");
		
		faXuLieHua(node.right);

		faXuLieHua(node.left);
		
	}
    
    boolean isSymmetrical(TreeNode pRoot)
    {
        xuLieHua(pRoot);
		faXuLieHua(pRoot);
        return s.toString().equals(s1.toString());
    }
}

  

posted @ 2019-03-24 11:25  FigSprite  阅读(371)  评论(0编辑  收藏  举报