← 返回 meta 的题目列表Construct Binary Tree from Preorder and Inorder Strings
类型:online_judge
meta
Given a string that represents preorder and inorder traversal of a binary tree, construct the binary tree. The string is separated by commas with two characters for each node and the preorder and inorder are separated by a vertical bar in the string. Your task is to reconstruct the binary tree and return its root node.
Example
Input
'A,B,C|B,A,C'