Facebook/Meta | London | Phone Screen
Anonymous User
2003

Recently did my phone screen for London location. Below two questions were asked-

  1. Given N sorted arrays, return a merged sorted array removing any duplicate values. For example [1,4,5,5,6], [2,3,4,5], [1,2,7,8] return [1,2,3,4,5,6,7,8].
    Solved it in about 20 mins.
  2. Return the longest distance between any two nodes of a binary tree. The keyword "longest" confused me for a sec but the question was essentially to return the distance between any 2 nodes of a binary tree. (Not a BST).
    Gave the solution approach and wrote basic skeleton of traversing and maintaining distance from the root node but couldn't solve the problem of finding the lowest common ancesstor of the tree.

Don't have high hopes as I couldn't solve the 2nd problem.

Comments (8)