1 Read question2 Draft response3 Review notes
Netflix · Coding
Sort by User Preference
Must priorityMedium
The questionDesign and implement a system to sort and display shows based on user preferences
Executable browser contract: Implement rank_items(items, limit=None), where items contains (id, score). Keep only the greatest score for duplicate IDs, order by descending score then ascending ID, and optionally return at most limit rows. Reject a negative limit.
Try a first passNo account required. Nothing you type here is sent or saved.
Ready to work it, not just read it?Create an anonymous workspace to open the right editor, save your attempt, and track this question.
Practice this question free →