8000 Create README - LeetHub · karygauss03/Leetcode-Solutions@ef68054 · GitHub
[go: up one dir, main page]

Skip to content 65F2

Commit ef68054

Browse files
committed
Create README - LeetHub
1 parent 1823d78 commit ef68054

File tree

1 file changed

+31
-0
lines changed
  • 0925-construct-binary-tree-from-preorder-and-postorder-traversal

1 file changed

+31
-0
lines changed
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/construct-binary-tree-from-preorder-and-postorder-traversal">925. Construct Binary Tree from Preorder and Postorder Traversal</a></h2><h3>Medium</h3><hr><p>Given two integer arrays, <code>preorder</code> and <code>postorder</code> where <code>preorder</code> is the preorder traversal of a binary tree of <strong>distinct</strong> values and <code>postorder</code> is the postorder traversal of the same tree, reconstruct and return <em>the binary tree</em>.</p>
2+
3+
<p>If there exist multiple answers, you can <strong>return any</strong> of them.</p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
<img alt="" src="https://assets.leetcode.com/uploads/2021/07/24/lc-prepost.jpg" style="width: 304px; height: 265px;" />
8+
<pre>
9+
<strong>Input:</strong> preorder = [1,2,4,5,3,6,7], postorder = [4,5,2,6,7,3,1]
10+
<strong>Output:</strong> [1,2,3,4,5,6,7]
11+
</pre>
12+
13+
<p><strong class="example">Example 2:</strong></p>
14+
15+
<pre>
16+
<strong>Input:</strong> preorder = [1], postorder = [1]
17+
<strong>Output:</strong> [1]
18+
</pre>
19+
20+
<p>&nbsp;</p>
21+
<p><strong>Constraints:</strong></p>
22+
23+
<ul>
24+
<li><code>1 &lt;= preorder.length &lt;= 30</code></li>
25+
<li><code>1 &lt;= preorder[i] &lt;= preorder.length</code></li>
26+
<li>All the values of <code>preorder</code> are <strong>unique</strong>.</li>
27+
<li><code>postorder.length == preorder.length</code></li>
28+
<li><code>1 &lt;= postorder[i] &lt;= postorder.length</code></li>
29+
<li>All the values of <code>postorder</code> are <strong>unique</strong>.</li>
30+
<li>It is guaranteed that <code>preorder</code> and <code>postorder</code> are the preorder traversal and postorder traversal of the same binary tree.</li>
31+
</ul>

0 commit comments

Comments
 (0)
0