The interviewer called for the phone interview on time and provided 35 minutes to complete the coding task on CoderPad. It wasn't enough time for me to complete the code, compile, and run test cases, but I explained what I would do. I did not get the on-site interview. It looks like there are people who can complete code, compile, and run test cases in 30 minutes.
Given an array of arrays, implement an iterator class to allow the client to traverse and remove elements in the array list. This iterator should provide three public class member functions:
boolean has_next() Returns true or false if there is another element in the set.
int next() Returns the value of the next element in the set.
void remove()
Removes the last element returned by the iterator. That is, removes the element that the previous next() returned.
This method can be called only once per call to next(), otherwise, an exception will be thrown. See http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html#remove() for details.
The code should be well-structured and robust enough to handle any access pattern. Additionally, write code to demonstrate that the class can be used for the following basic scenarios:
Print elements
Given: [[],[1,2,3],[4,5],[],[],[6],[7,8],[],[9],[10],[]]
Print: 1 2 3 4 5 6 7 8 9 10
Remove even elements
Given: [[],[1,2,3],[4,5],[],[],[6],[7,8],[],[9],[10],[]]
Should result in: [[],[1,3],[5],[],[],[],[7],[],[9],[],[]]
Print: 1 3 5 7 9
java import java.io.; import java.util.;
/*
The following metrics were computed from 1 interview experience for the Airbnb Full Stack Software Engineer role in San Francisco, California.
Airbnb's interview process for their Full Stack Software Engineer roles in San Francisco, California is extremely selective, failing the vast majority of engineers.
Candidates reported having very good feelings for Airbnb's Full Stack Software Engineer interview process in San Francisco, California.