Question
Implement `ResumableListIterator`, an iterator that can save and restore its progress. `get_state()` must return a JSON-serializable value that fully identifies the next item to produce. `set_state(state)` must restore that position so iteration continues without repeating or skipping values. The iterator should use constant additional memory and follow normal Python iterator behavior at end of input. Handle empty and single-item lists, restoration at the beginning and end, invalid state, and repeated save/restore cycles. ## Follow-ups 1. Extend the design to a nested iterator. 2. Detect restoration against a changed underlying collection. 3. Make checkpoints portable across processes without serializing all input data.