Code RoomMost played song
EasyPrep Room Coding #436

Most played song

CodingAlgorithms & data structuresEntry–Mid~11 min

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.

0:00 of about 11 min
InputExpectedGot
[["a","b","b","a","c","b"]]"b"not run yetsample