[LeetCode] Same Tree

2017-10-18  本文已影响0人  lalulalula

1.Given two binary trees, write a function to check if they are equal or not.

Two binary trees are considered equal if they are structurally identical and the nodes have the same value.

2.题目要求:判断两个二叉树是否相等。

3.方法:检查当前节点的左右节点是否相同,然后递归检查左子树和右子树。

4.代码:
/**

上一篇 下一篇

猜你喜欢

热点阅读