Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
描述
判断一棵树是否是镜面反射,主要看其是否中心对称
分析
将一棵树翻转,然后判断两棵树是否相等
代码
递归:
1 | /** |
非递归:
1 | public class Solution { |
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
判断一棵树是否是镜面反射,主要看其是否中心对称
将一棵树翻转,然后判断两棵树是否相等
递归:
1 | /** |
非递归:
1 | public class Solution { |