Update 28. 对称的二叉树.md

补充对称二叉树解法中关于两棵子树互为镜像判定的思路说明。
This commit is contained in:
CyC2018
2026-10-30 20:18:01 +08:00
parent c8c49f8774
commit 4890857278
+2
View File
@@ -10,6 +10,8 @@
## 解题思路
一棵树对称,等价于根的左右子树互为镜像。比较两棵子树 t1 和 t2 是否互为镜像:根的值相同,并且 t1 的左子树与 t2 的右子树互为镜像、t1 的右子树与 t2 的左子树互为镜像。
```java
public boolean checkSymmetricTree(TreeNode root) {
if (root == null)