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

Question

Two listeners share a household account, and each has a play history: a list of podcast episode ids, with repeats whenever an episode was replayed. For a coverage report, count how many distinct episodes were played by at least one of the two listeners — the size of the union of their distinct episode sets. For example, histories ["e1", "e2"] and ["e2", "e3", "e3"] cover the episodes e1, e2 and e3, so the answer is 3. Two empty histories give 0. Return the count as an integer.

Implement
distinct_across(a: list[str], b: list[str]) → int
Examples
in[["e1","e2"],["e2","e3","e3"]]out3
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.