Code RoomShared distinct tags
EasyPrep Room Coding #440

Shared distinct tags

CodingAlgorithms & data structuresEntry–Mid~10 min

Two curators each maintain a tag list for their own playlist, and tags may repeat within either list. To measure how similar the playlists are, count how many distinct tags appear in both lists (the size of the intersection of their distinct tag sets). Repeats never add to the count. For example, ["rock", "pop", "jazz"] and ["pop", "jazz", "folk", "pop"] share the two tags "pop" and "jazz", so the answer is 2. Return the count as an integer.

Implement
shared_tag_count(a: list[str], b: list[str]) → int
Examples
in[["rock","pop","jazz"],["pop","jazz","folk","pop"]]out2
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
[["rock","pop","jazz"],["pop","jazz","folk","pop"]]2not run yetsample