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 AccessThe 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.
class ChatEventTracker:
...Run your code to see results.