Skip to main content
DevHives

Build a Tree From Preorder and Inorder

Loading editor…

3 examples run when you press Run. Submit checks every hidden test too.

Case 1
Input:
[7,2,5,9,1,8], [5,2,7,1,9,8]
Expected:
[7,2,9,5,null,1,8]
Case 2
Input:
[-4], [-4]
Expected:
[-4]
Case 3
Input:
[1,6,3], [6,3,1]
Expected:
[1,6,null,null,3]
Ready

Run checks your code against the 3 examples. Submit checks it against all 123 tests and needs a free account. You can also try ideas in the free JavaScript or Python compiler.