Episode played k times
A podcast app logs every episode play in one session as a list of episode ids, in play order. An analyst wants the episode that was played exactly k times; if several episodes tie, they want the one whose first play happened earliest in the session. Given the log and an integer k (k >= 1), return that episode id, or an empty string when no episode was played exactly k times. For example, with log ["e1","e2","e1","e3","e2","e1"] and k = 2, episode "e2" is the answer.
Implement
first_exactly_k(episodes: list[str], k: int) → strExamples
in
[["e1","e2","e1","e3","e2","e1"],2]out"e2"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
solution.py
InputExpectedGot
[["e1","e2","e1","e3","e2","e1"],2]"e2"not run yetsample