Meta Interview Question

Coding round: given user-item interaction logs, implement a function to compute the top-k most similar items using cosine similarity.