Verified interview challenge
Implement a resumable iterator
Build an iterator that can save its position and pick up again from a saved state.
Unlock with Full AccessThe challenge
Process a sequence of iterator operations while keeping track of the current position. Callers can save that position and restore it later, including after reaching the end. The full problem defines the operations and the output each one should produce.
What you'll practise
Iterator behaviour
Keep traversal and end-of-input behaviour consistent.
Saving and restoring state
Resume from an earlier position without changing the input data.
Operation sequences
Handle repeated restores and produce results in the expected order.
solution.pyPython 3.13
def run_resumable_iterator(
values, operations
):
# Your implementation goes here
passTest cases
Run your code to see results.
Full instructions, starter code and test cases included with Full Access.