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

Question

Given a non-empty play log — a list of song ids in the order they were played — return the id of the song with the highest total play count. If two or more songs tie for the highest count, return the alphabetically (lexicographically) smallest id among them, so the result is fully deterministic. For example, ["a", "b", "b", "a", "c", "b"] returns "b" (three plays), while ["c", "b", "c", "b", "a", "a"] returns "a" because all three songs tie at two plays each.

Implement
most_played(plays: list[str]) → str
Examples
in[["a","b","b","a","c","b"]]out"b"
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.