Hi, just had a screen inteview 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 (5)


