Facebook Screen Interview

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2021-04-20Added By Anonymous
Source: Link

Company: Meta
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Hi, just had a screen interview I hope you find it useful.

Question 1) Merge two sorted arrays
Input:
  int[] arr1 = {1, 2, 4, _, _, _}
  int[] arr2 = {2, 3, 5}
Output:
int[] arr1 = {1, 2, 2, 3, 4, 5}

Question 2) In a binary tree, sum numbers in range
Input:
int low = 1;
int high = 5
Given a Tree t
*              8 <------ root
*             / \
*           3   10
*          / \    \
*        1   6     14
*           / \  /
*          4   7  13
Output:
int result = 8;
Explanation: 1, 3 and 4 are in the range of 1 and 5 then the sum of this is 1 + 3 + 4 = 8

Comments