Skip to content

Commit c0c782e

Browse files
committed
Create README - LeetHub
1 parent f91d3c0 commit c0c782e

File tree

1 file changed

+28
-0
lines changed
  • 105-construct-binary-tree-from-preorder-and-inorder-traversal

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<h2><a href="https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/">105. Construct Binary Tree from Preorder and Inorder Traversal</a></h2><h3>Medium</h3><hr><div><p>Given two integer arrays <code>preorder</code> and <code>inorder</code> where <code>preorder</code> is the preorder traversal of a binary tree and <code>inorder</code> is the inorder traversal of the same tree, construct and return <em>the binary tree</em>.</p>
2+
3+
<p>&nbsp;</p>
4+
<p><strong>Example 1:</strong></p>
5+
<img alt="" src="https://assets.leetcode.com/uploads/2021/02/19/tree.jpg" style="width: 277px; height: 302px;">
6+
<pre><strong>Input:</strong> preorder = [3,9,20,15,7], inorder = [9,3,15,20,7]
7+
<strong>Output:</strong> [3,9,20,null,null,15,7]
8+
</pre>
9+
10+
<p><strong>Example 2:</strong></p>
11+
12+
<pre><strong>Input:</strong> preorder = [-1], inorder = [-1]
13+
<strong>Output:</strong> [-1]
14+
</pre>
15+
16+
<p>&nbsp;</p>
17+
<p><strong>Constraints:</strong></p>
18+
19+
<ul>
20+
<li><code>1 &lt;= preorder.length &lt;= 3000</code></li>
21+
<li><code>inorder.length == preorder.length</code></li>
22+
<li><code>-3000 &lt;= preorder[i], inorder[i] &lt;= 3000</code></li>
23+
<li><code>preorder</code> and <code>inorder</code> consist of <strong>unique</strong> values.</li>
24+
<li>Each value of <code>inorder</code> also appears in <code>preorder</code>.</li>
25+
<li><code>preorder</code> is <strong>guaranteed</strong> to be the preorder traversal of the tree.</li>
26+
<li><code>inorder</code> is <strong>guaranteed</strong> to be the inorder traversal of the tree.</li>
27+
</ul>
28+
</div>

0 commit comments

Comments
 (0)