OpenAI

Verified interview challenge

Rectangle Board

Build a rectangle board whose changes can be undone, even when several overlapping rectangles are removed together.

Unlock with Full Access

The challenge

Start by adding rectangles, then remove them by ID or position. Add undo history before handling batch removal as a single reversible action. The five parts share one Python class. Choose guided practice or a 60-minute practice timer.

What you'll practise

  • Spatial selection

    Choose the right rectangles when their positions and boundaries overlap.

  • Reversible operations

    Restore earlier state without losing identities or creation order.

  • Batch changes

    Treat several removals as one action while preserving earlier methods.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.