2D List Iterator
Airbnb interview questions · Hard · Coding round · 6 tests
Design an iterator over a 2D list of integers. The iterator must flatten the values in row-major
order and support removing the last value returned by next().
Interface
class TwoDIterator {
constructor(values: number[][])
hasNext(): boolean
next(): number | null
remove(): void
}
Rules
Run your code with Ctrl+Enter to see results.