Resumable Iterator with Multi-Dimensional Support

Asked at OpenAI · Coding Questions · Difficulty: Medium · Last asked Jun 20, 2026

You need to build a system that can pause and restart a loop (iteration). You must be able to save your current spot and come back to it later. The problem starts easy and gets harder in four steps: defining the rules, making a simple list iterator, making a 2D iterator (matrix), and finally a 3D iterator. The main goal is to save the "state" (your position) so you can resume exactly where you left off.

Loading the problem…