LeetCode-100

Links:https://leetcode.com/problems/same-tree/

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.

思路:判断当前节点相等,左右子节点相同。

相同的可能性:

1.都为空(NULL)

2.当前节点相等,左右子节点相同。

【LeetCode】100. Same Tree
Tagged on:
0 0 vote
Article Rating
订阅
提醒
0 评论
Inline Feedbacks
View all comments