OpenAI

Verified interview challenge

Chat Event Stream Tracker

Track recent chat activity while old events expire and newer arrivals change each session's state.

Unlock with Full Access

The challenge

Build an in-memory tracker for users chatting across several sessions. Start with recent interaction counts, add session endings and active-chat counts, then handle events arriving out of order. Keep the state bounded as the stream grows. The three parts share one Python file, with guided practice or a 60-minute timed mock.

What you'll practise

  • Sliding windows

    Keep recent counts correct when events for different users advance the clock.

  • Session state

    Track endings and reopenings without counting a chat twice.

  • Late events

    Separate event time from arrival order while removing expired state.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
class ChatEventTracker:
    ...
Current-part checks

Run your code to see results.

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