← Questions
Construct binary tree from inorder and postorder traversal
0
I was asked this
No reports yet. Sign in to say where you were asked it.
Given the inorder and postorder traversals of a binary tree with distinct values, rebuild the tree. The last postorder value is the root; its position in the inorder list splits the left and right subtrees. Write it first with list slicing, then with index bounds and a value-to-index map so it runs in linear time.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
