博文中会简要介绍Leetcode P0100题目分析及解题思路。
“Same Tree”是一道比较基础的树问题,深度优先搜索即可解决。
Given two binary trees, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical and the nodes have the same value.
以下是Java的题解代码实现。
以下是C++的题解代码实现。