Airbnb Interview experience
1 round over 5 weeks. Withdrew, good experience.
Was asked to create an iterator for a nested list of integers. I solved it in time and the interviewer was nice and helpful.
Problem Statement:
You’re given a nested list that contains both integers and arrays (which can have more integers or even other arrays). Your task is to implement an iterator that can go through all the elements in the list by flattening any arrays along the way and outputs all the integers in order.
was told to implement the following methods:
hasNext(): Returns true if there are more elements (either integers or arrays) to iterate over, or false if we've reached the end.
next(): Returns the next element in the list (either an integer or an array).
remove(): Removes the current element (the one returned last by the next() method)
Example:
Input: [[], [1, 2], [3, [4, 5]], [[6], 7], []]
Output: 1, 2, 3, 4, 5, 6, 7It took a while to get the feedback for the phone interview as I had to follow up twice with the recruiter. I got another offer by the time they scheduled an onsite and decided not to move forward, but overall it was a good experience.
Know someone interviewing at Airbnb? Pass it on.
Same company, different candidates.
Share yours while it’s fresh. It takes five minutes, it’s anonymous, and it will help future candidates.