摘要:
class Solution { public boolean isSymmetric(TreeNode root) { if(root == null) return true; return judge(root.left, root.right); } private boolean judg 阅读全文
摘要:
翻转这个操作也是需要遍历,遍历无非dfs或者bfs,dfs无非前中后序遍历。这里采用前序遍历或者后序遍历,否则有的会被翻转两次。 最重要的是,翻转的时候传入的参数是root,而非要被翻转的两个节点。 class Solution { public TreeNode invertTree(TreeNo 阅读全文