Episode played k times
Your task
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.
Examples
first_exactly_k(episodes: list[str], k: int) -> strExample 1
Input
first_exactly_k(["e1", "e2", "e1", "e3", "e2", "e1"], 2)Output
"e2"