Skip to content

Files

Latest commit

d999fae · Apr 21, 2020

History

History

problem048

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 19, 2020
Apr 19, 2020
Apr 21, 2020

Daily Coding Problem: Problem #48

Good morning! Here's your coding interview problem for today.

This problem was asked by Google.

Given pre-order and in-order traversals of a binary tree, write a function to reconstruct the tree.

For example, given the following preorder traversal:

[a, b, d, e, c, f, g]

And the following inorder traversal:

[d, b, e, a, f, c, g]

You should return the following tree:

    a
   / \
  b   c
 / \ / \
d  e f  g