Airbnb | Phone Screen | 10 Wizards

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2019-11-01Added By Anonymous
Source: Link

AirBnb software engineer position. Location: Bay Area Experience: 0-2 years


Do not remember the question word to word but here is the summary:

Given a list of lists of Integers, find the shortest path for one list element to seek a certain element.


Example List:

(1,2,3) //index 0

(8,6,4) //index 1

(4,5,6) //index 2

...

(9,1) //index 6

(1) //index 8

..

until index 9


Find the minimum cost such that: start at index 0 (1,2,3) and find all the paths till u find a certain number (in my case, i was asked to find a path starting at index 0 until I find number 9).

so the path will look something like: [1,6,9]. Cost: [(6-1)^2 + (9-6)^2] = 25 + 9 = 34;

there can be other paths but return/print the min cost path.


I used Depth First Search to implement this. Hope this helps to anyone who is interviewing with AirBnb anytime soon. Good luck!

Comments