Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Construct Binary Tree from Inorder and Postorder Traversal
Bookmark
Linear Search
Hash Map
Two Pointers
Input
Standard
Balanced
Custom
inorder
=
[9, 3, 15, 20, 7]
,
postorder
=
[9, 15, 7, 20, 3]
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
20
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
20
15
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
20
15
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
20
15
7
inorder
0
9
1
3
2
15
3
20
4
7
postorder
0
9
1
15
2
7
3
20
4
3
3
9
20
15
7
algo
master
.
io
Step:
Start: build the tree, finding each root by scanning inorder
0 / 43
Input
Standard
Balanced
Custom
inorder
=
[9, 3, 15, 20, 7]
,
postorder
=
[9, 15, 7, 20, 3]
0 / 43
algo
master
.
io
Step:
Start: build the tree, finding each root by scanning inorder