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 投票数
Article Rating
订阅评论
提醒

0 评论
最新
最旧 最多投票
内联反馈
查看所有评论