Feature #5: Fetch Most Recently Watched Titles

Implementing the "Fetch Most Recently Watched Titles" feature for our "Netflix" project.

Description

We want to implement a feature so that the user can view the n titles that they’ve watched or accessed most recently. You need to come up with a data structure for this feature. Let’s break it down. If we think it through, we realize the following: i) This data structure should maintain titles in order of time since last access; ii) If the data structure is at its capacity, an insertion should replace the least recently accessed item.

Let’s say that a user has gone through the following titles:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.