Skip to content

Commit 5bc9809

Browse files
committed
Create README - LeetHub
1 parent 39ba7db commit 5bc9809

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

0872-leaf-similar-trees/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<h2><a href="https://leetcode.com/problems/leaf-similar-trees/">872. Leaf-Similar Trees</a></h2><h3>Easy</h3><hr><div><p>Consider all the leaves of a binary tree, from&nbsp;left to right order, the values of those&nbsp;leaves form a <strong>leaf value sequence</strong><em>.</em></p>
2+
3+
<p><img alt="" src="https://s3-lc-upload.s3.amazonaws.com/uploads/2018/07/16/tree.png" style="width: 400px; height: 336px;"></p>
4+
5+
<p>For example, in the given tree above, the leaf value sequence is <code>(6, 7, 4, 9, 8)</code>.</p>
6+
7+
<p>Two binary trees are considered <em>leaf-similar</em>&nbsp;if their leaf value sequence is the same.</p>
8+
9+
<p>Return <code>true</code> if and only if the two given trees with head nodes <code>root1</code> and <code>root2</code> are leaf-similar.</p>
10+
11+
<p>&nbsp;</p>
12+
<p><strong class="example">Example 1:</strong></p>
13+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/03/leaf-similar-1.jpg" style="width: 600px; height: 237px;">
14+
<pre><strong>Input:</strong> root1 = [3,5,1,6,2,9,8,null,null,7,4], root2 = [3,5,1,6,7,4,2,null,null,null,null,null,null,9,8]
15+
<strong>Output:</strong> true
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/03/leaf-similar-2.jpg" style="width: 300px; height: 110px;">
20+
<pre><strong>Input:</strong> root1 = [1,2,3], root2 = [1,3,2]
21+
<strong>Output:</strong> false
22+
</pre>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Constraints:</strong></p>
26+
27+
<ul>
28+
<li>The number of nodes in each tree will be in the range <code>[1, 200]</code>.</li>
29+
<li>Both of the given trees will have values in the range <code>[0, 200]</code>.</li>
30+
</ul>
31+
</div>

0 commit comments

Comments
 (0)