This question evaluates understanding of graph traversal and shortest-path distance concepts along with multi-criteria ranking (distance, rating, ID) and efficient exploration of large undirected graphs to avoid revisiting nodes.
You are building a simple movie recommendation feature.
0..(M-1)
.
adj
, where
adj[i]
lists movies similar to movie
i
.
rating[i]
(or
score[i]
) for each movie.
start
that the user liked.
watched
of movies the user has already watched.
K
.
Return a list of up to K recommended movie IDs that the user has not watched.
start
.
rating
.
K
unwatched movies are reachable, return all reachable unwatched movies.
What potential issues might arise when deploying this in production (e.g., caching, concurrency, hot keys, stale data), and how would you mitigate them?