Airbnb Interview Question

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: hasNext(), next(), and remove().

Interview Answer

Anonymous

Sep 26, 2017

I tried to use a queue and a stack together, which didn't work. The correct answer was using 2 pointers with a linked-list.