Code RoomFirst unique play
EasyPrep Room Coding #418

First unique play

CodingAlgorithms & data structuresEntry–Mid~10 min

A music app keeps a play log for one listening session: a list of song ids in the order they were played. The product team wants to surface the first song the listener played exactly once across the whole session. Given the log, return the id of the earliest-played song whose total play count is 1. If every song in the log was played more than once, or the log is empty, return an empty string. For example, in ["hills","echo","hills","nova"] the answer is "echo".

Implement
first_unique_song(plays: list[str]) → str
Examples
in[["hills","echo","hills","nova"]]out"echo"
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 10 min
InputExpectedGot
[["hills","echo","hills","nova"]]"echo"not run yetsample