Code Room
CodingEasycod-g1237
Subject HashingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.