Code RoomUnion of distinct episodes
EasyPrep Room Coding #454

Union of distinct episodes

CodingAlgorithms & data structuresEntry–Mid~10 min

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.

0:00 of about 10 min
InputExpectedGot
[["e1","e2"],["e2","e3","e3"]]3not run yetsample