class Solution { public boolean isSymmetric(TreeNode root) { if (root == null) { return true; } return isMirror(root.left, root.right); } public boolean isMirror(TreeNode left, TreeNode right) { if (left == null && right == null) { return true; } if (left == null || right == null) { return false; } if (left.val != right.val) { return false; } return isMirror(left.left, right.right) && isMirror(left.right, right.left); } }
标签:isMirror,right,return,null,力扣,二叉树,101,root,left From: https://www.cnblogs.com/JavaYuYin/p/18017427