1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-12-15 23:22:36 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-03-29 12:43:11 +08:00
parent 58bbdfd57c
commit 2b0511d272
10721 changed files with 8123 additions and 8119 deletions

View File

@@ -0,0 +1,25 @@
<p>检查子树。你有两棵非常大的二叉树T1有几万个节点T2有几万个节点。设计一个算法判断 T2 是否为 T1 的子树。</p>
<p>如果 T1 有这么一个节点 n其子树与 T2 一模一样,则 T2 为 T1 的子树,也就是说,从节点 n 处把树砍断,得到的树与 T2 完全相同。</p>
<p><strong>注意:</strong>此题相对书上原题略有改动。</p>
<p><strong>示例1:</strong></p>
<pre>
<strong> 输入</strong>t1 = [1, 2, 3], t2 = [2]
<strong> 输出</strong>true
</pre>
<p><strong>示例2:</strong></p>
<pre>
<strong> 输入</strong>t1 = [1, null, 2, 4], t2 = [3, 2]
<strong> 输出</strong>false
</pre>
<p><strong>提示:</strong></p>
<ol>
<li>树的节点数目范围为[0, 20000]。</li>
</ol>