You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
return (f:=lambda i,p:TreeNode(p[-1],f(i[:(k:=i.index(p[-1]))],p[:k]),f(i[k+1:],p[k:-1])) if i else None)(inorder,postorder)
test('''
106. Construct Binary Tree from Inorder and Postorder Traversal
Medium
6113
88
Add to List
Share
Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the same tree, construct and return the binary tree.