Google | Phone Interview | Build Special Binary Tree

Anonymous User
1843
Apr 13, 2022
Apr 14, 2022

I had a technical phone screen with Google today for an L4 position. The question was something like this:

Given a map of values where the key represents a letter & the value represents the depth build a tree where:

  1. The depth on the left side of the tree is lower than the right side.
  2. Only the leaves have values. All other nodes have * as a value.
  3. Leaves on the same level are ordered by their alphabetic key value.

Example:

Input : {"a": 2, "b": 1, "e": 2 }

Output:

     *
   /   \
 b      *
       / \
      a    e

Unfortunately, I could not get this one.

Comments (17)