← Back
00:00

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

Idle