Facebook | DC | phone interview HAVE YOU SEEN THIS BEFORE?
Anonymous User
1093

I have just finished my phone interview with FB. The interviewer was very mindful and helpful thoughtout the painful 45min where I was trying to come up with a non trivial solution for the coding challenge.

Here is the best description I can come up with for the problem

you have an array a = [2, 5, 8, 20, 10, 15, 40, 35, 30, 50]
That the array is seperated in predictible bucket where each buckets has all elements strictly smaller the the next one. example :

b1 = 2
b2 = 5 8
b3 = 20 10 15 
b4 = 40 35 30 50
#k buckets 
n = 1 + 2 + 3 + ... + k 
n = total number of elements in the array

Give the index of a target given as input
Input = 30, a
The expected output is 8.

Hint
think about a solution that is more efficient than o(n), use the fact that the first element of each bucket can give you a good idea on where you should go next

Comments (5)