Search⌘ K
AI Features

Feature #8: Verify User Session

Explore how to verify the correctness of user sessions by analyzing sequences of push and pop operations on a stack. Understand how to implement stack validation techniques to detect bugs in session handling, applying these concepts to real-world scenarios like Netflix's back button functionality.

Description

Netflix has received a user complaint about the Back button we implemented in the previous feature misbehaving. The complaint was that the viewing history was not shown in the sequence it was accessed. Being the lead developer of this functionality, you went through the logs and retrieved the sequence of push operations and the sequence of pop operations in separate lists. Each new entry that the user clicked went to the push operations list. Each time the user clicked the back button, the removed entry went to the pop operations list.

The user also had a session where they browsed for some titles or pressed the Back button several times. The user did not browse the same title more than once. At the end of the session, the Back button was disabled. Unfortunately, these logs are separate and there are no timestamps. We want to know if the stack handled the user session correctly or if there may be a bug in the stack ...